值集定义总结

一.从属值集的定义

1.弹性域中的从属值集的定义

在这里我们以资产模块的资产类别键弹性域为例,假如类别分为大类、小类。

小类的列表内容将依据大类变化。即大类为小类的父集。

我们首先建立2个值集,第一个值集命名为:UC_FAC_MAIN,注意选择验证类型为独立,创建结果如图1-1所示,

clip_image002[4]

1-1

第二个值集命名为:UC_FAC_MINO,在这里注意和第一个值集创建的区别了(注意:红色方框所标注的内容)。我们选择验证类型为从属,此时右边的编辑按钮可用,点击后进行设置,主要有2项设置:独立值集的设置(简单说就是为此值集选择父集)、从属默认值得设置(防止当用户没有在值集录入界面为对应的父集录入子集时,系统将默认带出在此设置的值)设置结果如图1-2所示:

clip_image004[4]

1-2

 

当定义完2个值集后,我们导航到菜单:应用->验证->,下为其录入列表值,首先为大类录入值,这很简单就是普通的录入。结果如图1-3所示:

clip_image006[4]

1-3

接着为小类录入值,他的录入有点特别,我们可以把焦点停在表单上部分的独立值项上,运用键盘的上下箭头,来为不同的独立值(即父值)录入不同的对应子集,每一个初始的独立值带出来的是我们上面设置的系统默认值(即:"不分明细")结果如图1-41-5所示,每一个值都有可以由用户设置启用或失效,对于层次结构、限定词主要在会计的科目中及一些汇总中用到。

clip_image008[4]

                                      1-4

clip_image010[4]

1-5

2.普通项中的从属值集的定义(一般用于报表参数)

在这里我们假如有个报表,需要2个参数(为了举例方便,取了这2个参数,可能不符合实际。)

帐套名称(cux_sob_id)、供应商名称(cux_vendor_id并且第二个参数依据第一个参数来弹出列表值

(即当选完帐套参数后,供应商值集列表中显示本帐套下的所有未失效的供应商)。这里我们还是定义2个值集,定义过程和上面例子的一样,只是在这里我们选择验证类型为表。

    此时点击右边的编辑按钮进行设置,这里主要是设置用户所需要的显示字段、传值字段、以及定义值集范围即(WHERE条件、排序等)。第一个参数他不附属与其他值集所以很简单,选择完表名、所需字段后保存即可,如图1-61-7所示:

clip_image012[4]

1-6

clip_image014[4]

1-7

接下来我创建第二个值集(cux_vendor_id)因为他要附属于第一个参数(cux_sob_id)所以我们在" 出处/排序依据"处进行添加条件:

set_of_books_id=nvl(:$FLEX$.cux_sob_id,set_of_books_id) 或者

set_of_books_id=nvl(:$FLEX$.cux_sob_id:NULL,set_of_books_id)

这样两个值集就关联起来了。

我们仔细看上面的2个语句,差别在于第二个语句多了一个(:NULL),他的作是当用户不选择他的父参数时,可以先选择他自己,反之,如果没有:NULL则用户必须选择完其父参数(本例为帐套名称)才能选择自己(本例为供应商名称)。设置结果如图1-81-9所示

clip_image016[4]

1-8

clip_image018[4]

1-9

运行报表时的效果如图1-101-11所示:

clip_image020[4]

1-10

clip_image022[4]

1-11

图中商业信息已屏蔽。

二.报表参数中调用键弹性域的定义

1.报表中调用间弹性域的定义

有时候我们的报表可能要调用系统的键弹性域作为值集给用户来选择(如会计科目、资产类别等),这里我们以我在项目上做的一个报表(UC_资产明细)为例,说明在报表参数中运用键弹性域。

我们知道一个键弹性域可以有多个结构,所以在调用一个键弹性域时除了要指明(APPL_SHORT_NAMECODE还要明确指出自己所需的那个结构,因此我们在定义并发程序时就应当额外创建一个隐藏的参数(P_CAT_SEG_NUM)来传递这个结构标识.而参数的值集我们在本例中为:CUX_ASSET_CAT_STRUCT_NUM,他的具体值我们可以从资产的系统控制表(fa_system_controls)中得到。

SQL 语句为:select category_flex_structure from fa_system_controls

具体设置结果如图2-12-2所示

clip_image024[4]

2-1

clip_image026[4]

2-2

接下来我们为真正显示在界面的参数 (资产类别 P_CAT_SEG) 定义值集。

定义过程和前面所讲的都基本相同,主要区别在于此值集的验证类型我们设置为特定,然后点右边的编辑按钮进行定义,需要注意的我已经用带色彩的框标记出来了,设置结果如图2-32-4所示。

具体语法参数的含义大家可以参考附录。

clip_image028[4]

                                       2-3

clip_image030[4]

2-4

三.描述性弹性域上下文的应用(键弹性域与描述性弹性域互动关系定义)

1. 描述性弹性域上下文的应用

在系统中描述性弹性域的显示结构是可以根据一个上下文字段来变化的,这样的设计会使应用层很灵活,进而在很多时候不用改动程序的基础上满足客户需求。

我是在资产工作台新建资产表单上进行的测试,当我们选择完资产类别后,紧随其后的描述性弹性域就根据前面所选择的资产类别而弹出不同的结构。下面我们来看下具体的定义过程:(本例我们用键弹性域返回的值作为上下文关系)

 

我们首先在Form中定义键弹性域,和描述性弹性域。代码如下:

clip_image032[4]

从代码中可知在资产新增表单中,键弹性域的显示项为:ATTRIBUTE_CATEGORY_CODE

所以我们在系统中定义此描述性弹性域时,设置其参考段为ATTRIBUTE_CATEGORY_CODE

如图3-1所示:

clip_image034[4]

3-1

接下来定义此弹性域的全局数据元(Global Data Elements)个人认为它就类似于一个键弹性域中的某一组合结构,在这里我们定义他由4个项组合(资产类别、网络属性、工程期别、使用状态)。顾名思义(全局嘛)它的特点就是不管上下文内容是什么,这4个项都会显示。在本例中的表现就是,不管用户选择何种资产类别,此描述性弹性域都会显示这4个项。具体结果如图3-23-3

clip_image036[4]

3-2

clip_image038[4]

3-3

接下来我们就开始定义具体上下文内容所对应的弹性域结构,本例只列举了2个例子(测试1、测试2)以作说明。我们想要达到的目的是:

当用户选择的资产类别为“管理用固定资产. 电子计算机系统”时,描述性弹性域就增加一个说明项测试1

当用户选择的资产类别为“长期待摊费用. 其他”时,描述性弹性域就增加一个说明项测试2

具体定义如图3-43-5所示:

clip_image040[4]

                                       3-4

clip_image042[4]

3-5

这时我们可以在界面测试下我们所定义的结果了,如图3-63-7所示

clip_image044[4]

3-6

clip_image046[4]

3-7

注意以上定义都是在定义描述性弹性域表单中未选中上下文显示复选框的情况下。

下面我们看看当选中显示复选框时(如图3-8)的结果和注意事项:

clip_image048[4]

当用户选择了显示复选框后,在引用弹性域的界面中点击弹性域项后,不管上下文段值是什么,他都会显示一个你在上图中定义的提示(附加信息),如果有多个上下文段他会有一个列表让用户选择,如果只有一个上下文段则直接显示在他的下面,结果如图3-83-9所示

clip_image050[4]

3-8

clip_image052[4]

3-9

这样就相当于强制使用了上下文关系,不管前面的键弹性域的资产类别选择了什么,描述性弹性域都会按客户强制的来存储。(这也只是一个测试,实际中不会这样用得吧)。

现在来我们看看这样做后台表中怎么来存储的,他和其他正常录入的有什么不同。

clip_image054[4]

蓝色为正常录入的结果,红色为强制的结果。

 

附录 Special Validation Value Sets

Special Validation Events

   Your special valid events include:

    Edit

    Validate

    Load

    Insert/Update

    Query

    Edit/Edit

    ListVal

The last four events are present in Oracle Application for compatiblity with future version,and you should not use them.

 

Special validation Edit Event:

Be fired when your user’s cursor enters the segment in a data entry mode.You usually use POPID for your edit event.

 

Special Validation Load Event:

Be fired after a query to populate your segment .You usually use LOADID for your load event.

 

Special Validation Validate Event:

Be fired after the user’s cursor leaves the segment or close the pop-up window,or whenever a default value is copied into segment or report parameter.You usually use VALID for your validate event.

Attention :You must have a Validate event.

 

Syntax for Special Validation

Syntax:

   #FND {POPID|LOADID|VALID}

     CODE=“flexfield code”

     APPL_SHORT_NAME=“application_short_name”

     VALIDATE=“{FULL|PARTIAL|NONE|QUERY}”

     SEG=“block.concatenated values field name”

     [BLOCK=“block_name”]

     [FIELD=“field_name”]

     [DERIVED=“:block.field Segment qualifer”]

     [READ_ONLY=“{Y|N}”]

     [DINSERT=“{Y|N}”]

     [WINDOW=“{Y|N}”]

     [ID=“block.unique ID field”]   

     [REQUIRED=“{Y|N}”]

     [DISPLAY=“{ALL| flexfield qualifier|segment number}”]

     [UPDATE=“{ALL| flexfield qualifier|segment number}”]

     [INSERT=“{ALL| flexfield qualifier|segment number}”]

     [DATA_FIELD=“concatenated hidden Ids field”]

     [DESC=“block.concatenated description field name”]

     [TITLE=“window title”]

     [VDATE=“date”]

     [NAVIGATE=“{Y|N}”]

     [AUTOPICK=“{Y|N}”]

     [NUM=“:structure defining field”]

     [COPY=“:block.field {ALL | flexfield qualifier}”]

     [VRULE=“flexfield qualifier segment qualifier

                     {I[nclude]|E[xclude]} APPL=shortname;

                       NAME=Message Dictionary message name

                      validation value1 …”]

     [VALATT=“:block.field flexfield qualifier segment qualifier”]

     [USEDBFLDS=“{Y|N}”]

     [COLUMN=“{column1(n) | column1 alias(n)} ,…”]

     [WHERE=“where clause”]

     [SET=“set number”]

     [ALLOWEDNULL=“{Y|N}”]

     [QUERY_SECURITY=“{Y|N}”]

     [QBE_IN=“{Y|N}”]

     [LONGLIST=“{Y|N}”]

     [NO_COMBMSG=“MESG_NAME”]

 

Parameter For Special Validation

CODE:The flexfield code you specify when you set up this flexfield using the Register Key Flexfield form.

APPL_SHORT_NAME:The application short name with Which your flexfield is registered.

VALIDATE:Use FULL to validate all segment Values and generate a new code combination and Dynamically insert into the table.

Use PARTIAL to validate each segment But no create a new combination.Use NONE if you wish no validation.

SEG:Block.concatenated values field name is a display,non-database form field that contains your concatenated segment values plus delimiters.

DERIVED:Use DERIVED to get the derived value of segment qualifier for a combination that someone types in.

READ_ONLY:Specify Y if you want to prevent any updating of your flexfield.

DINSERT:The DINSERT parameter turns dynamic inserts off or on for this form. You must set to N in a special validation value set.

WINDOW:Specify whether you want your user to type into a visible pop-up window.

ID:Specify the block.field that contains the unique ID for this flexfield.

REQUIRED:Specify whether your user can exit the flexfield window without entering segment values.

DISPLAY:Specify whether you allow your user to display segments that specified flexfield qualifiers or specified segment number.

UPDATE INSERT:Determine whether your user can update or insert segments that represent specified unique flexfield qualifier or segment number.

DATA_FIELD:The concatenated hidden Ids field is a non-display form field that contains the concatenated segment hidden ID.

DESC:Is a displayed,non-database ,non-entered field that contains concatenated description of your segment values.

TITLE:The title that appears at the top of pop-up window.

VDATE:Date is the validation date against which the start date or end date of individual segment values is checked.

NAVIDATE:Specified Y if flexfields should automatically determine the navigation out of the flexfield pop-up window.

ATOPICK:Specify whether flexfield pops up a LOV window when user enters an invalid value. The default value is Y.

NUM:The definition number of your flexfield structure. The default value is 101

COPY:Copies a non-null value from :block.field into the segment representing the specified flexfield qualifier or segment number before the field window pops up.

VRULE:Use VRULE to put extra restrictions on what values a user can enter in a flexfield segment based on the values of segment quaifer.

VALATT:VALATT copies the segment qualifier values of the segment representing the unique flexfield qualifier into   :block.field when the flexfield window closes.

USEDBFLDS:Specify Y if your form is based on a table that has foreign key references to two or more flexfields.

COLUMN:Display other columns from the combination table in addition to the current segment column.

WHERE:Specify a WHERE clause to customize which code combination s to display in the combination-level list of values pop-up window.

SET:Specify the :block.field that holds the set identifier for your flexfield.

ALLOW NULLS:Determine whether NULLs should be allowed into any segment.

QBE_IN:Controls the type of subquery Oracle application object library uses to select the desired rows.

LONGLIST:Specify whether allow LongList with this flexfield.

NO_COMB MSG:Message name that you wish to display your own message when a user enters an invalid combination.

 

Defining Your Special Validation Function

Special validation provides several arguments you can use to pass value to from your user exits:

:!ID

:!VALUE

:!MEANING

!DIR

 

:!ID : You can use :!ID to pass different information depending upon the circumstance. For flexfield routines, :!ID can pass either a combination   ID number of an entire combination of segment values ,or it can pass a concatenated string of the individual flexfield segment values.

 

:!VALUE : You use :!VALUE to access the user’s input .:!VALUE refers to the displayed values that appear in the flexfield window and in the concatenated values field. If you do not specify a value for :!ID ,then :!VALUE is passed to your report or stored in your segment column.

 

:!MEANING : You use :!MEANING to pass the concatenated descriptions of your flexfield values. The value description appears as usual next to the flexfield segment value and in the concatenated description field. If you are writing your own function,you should code your user exit to write the value description into :!MEANING.

 

!DIR : Use !DIR for the NAVIGATE argument of key and descriptive flexfields routines. !DIR allows the flexfields routines to determine the proper navigation direction when you use a flexfield as a segment value set.

 

Example of Special validation

Problem Suppose you want to let your users pass a single combination of concatenated Accounting flexfield segments as parameter to a report. To let your user choose a single combination ,you must provide a key flexfield window from within the report parameters window on the reports form.

Solution You simply define a value set with special validation and use your familiar flexfield user exit.

 

For data entry validation(Event=Edit)

FND   POPID

      ALLP_SHORT_NAME=SQLGL

      CODE=“GL#”

      NUM=101

      REQUIRED=Y

      VALIDATE=FULL

      ID=:!ID

      SEG=:!VALUE

      DESC=:!MEANING

      NAVIGATE=!DIR

      DINSERT=N

For data entry validation(Event=Load)

FND   LOADID

      ALLP_SHORT_NAME=SQLGL

      CODE=“GL#”

      NUM=101

      REQUIRED=Y

      VALIDATE=FULL

      ID=:!ID

      SEG=:!VALUE

      DESC=:!MEANING

      DINSERT=N

For data entry validation(Event=Validate)

FND   VALID

      ALLP_SHORT_NAME=SQLGL

      CODE=“GL#”

      NUM=101

      REQUIRED=Y

      VALIDATE=FULL

      ID=:!ID

      SEG=:!VALUE

原文地址:https://www.cnblogs.com/quanweiru/p/4629291.html