账户键弹性域开发

账户键弹性域开发


账户键弹性域开发

3.1开发目的

1.在客户化form中引用Oracle EBS的物料编码信息,LOV返回物料编码

2.选择数据的界面根据Oracle EBS的设置自动显示查询数据库时,能根据系统的设
自动查询出物料编码及其描述

3.省去关联物料视图的操作,更快速

3.2开发前提

1.Oracle EBS已设置好物料编码配置

2.数据块中必须包括一个物料编码ID的数据库项

3.3开发步骤

1.创建一个非数据库项来显示账户与描述的组合信息,称为账户项,一般以DSP结尾

2.设置账户项的lov属性为ENABLE_LIST_LAMP,从列表验证设为:NO

3.为账户项添加WHEN-NEW-ITEM-INSTANCE触发器和代码,设置触发器执行层次为:Before

4.为账户项添加WHEN-VALIDATE-ITEM触发器和代码

5.为需要显示账户的描述,再添加一个非数据库项列,称为账户描述

6.为账号项添加所需触发器和相应代码:PRE-QUERY,POST-QUERY,PRE-INSERT,PRE-UPDATE,WHEN-VALIDATE-RECORD

7.在WHEN-NEW-FORM-INSTANCE触发器中初始化Account Key Flexfield,设置参数与数据块中的各个项关联起来

3.4实施过程

1.主数据块中包括了对应CCID的数据库列account_ccid

2.在主数据块中创建显示账户的非数据块ITEM:ACCOUNT_DSP;账户描述非数据块项ACCOUNT_DESCRIPTION

ACCOUNT_DSP:
属性                                    值
Subclass Information     TEXT_ITEM
Maximum Length           2000
Database Item              No
List of Value                  ENABLE_LIST_LAMP
Validate from list            No
    
ACCOUNT_DESCRIPTION:
属性                                    值
Subclass Information     TEXT_ITEM_DISPLAY_ONLY
Maximum Length           2000
Database Item              No
    

3.如果是folder功能的form,将刚创建的两个item copy到folder显示的**_prompt块中,设置item的属性分别为:

ACCOUNT_DSP
属性                                   值
Subclass Information     FOLDER_PROMPT_MULTIROW
Initial value                  ACCOUNT_DSP
    
ACCOUNT_DESCRIPTION
属性                                   值
Subclass Information     FOLDER_PROMPT_MULTIROW
Initial value                  ACCOUNT_DESCRIPTION
    
注意:
上述4个item若需要显示到画布上时需设定相应的canvas属性,选择要显示的画布。

4.在主数据块的trigger中添加如下trigger:
Trigger                                                   代码
PRE-QUERY                             Fnd_flex.event(‘PRE-QUERY’);
POST-QUERY                           Fnd_flex.event(‘POST-QUERY’);
PRE-INSERT                            Fnd_flex.event(‘PRE-INSERT’);
PRE-UPDATE                           Fnd_flex.event(‘PRE-UPDATE’);
WHEN-VALIDATE-RECORD        Fnd_flex.event(‘WHEN-VALIDATE-RECORD’);
 
5.在ACCOUNT_DSP列下添加相应trigger:
Trigger                                                  代码
WHEN-NEW-ITEM-INSTANCE     Fnd_flex.event(‘WHEN-NEW-ITEM-INSTANCE’);
WHEN-VALIDATE-ITEM              Fnd_flex.event(‘WHEN-VALIDATE-ITEM’);
    
设置WHEN-VALIDATE-ITEM的Execution Hiberarchy属性为:before

6.在form级trigger:PRE-FORM中添加如下代码:

--定义:    
l_coa_id number;
                                      l_sob_id number;
                                      l_currency_code varchar2(15);
                                      l_org_id number;
    
                                     cursor sob_cur(sob_id number) is
                                                 select sob.set_of_books_id,
                                                            sob.currency_code,
                                                            sob.chart_of_accounts_id
                                                from gl_sets_of_books sob
                                               where sob.set_of_books_id = sob_id;

--begin:
l_org_id := fnd_profile.value('ORG_ID');
if(l_org_id is null) then
                                      fnd_message.set_name('FND','PROFILES-CANNOT READ');
                                      fnd_message.set_token('OPTION','ORG_ID');
                                      fnd_message.error;
                                      raise form_trigger_failure;
end if;

--l_sob_id := fnd_profile.value(‘GL_SET_OF_BKS_ID’);
select ou.set_of_books_id
into l_sob_id
from hr_operating_units ou
where ou.organization_id = l_org_id;

if (l_sob_id is null) then
                                          fnd_message.set_name('FND','PROFILES-CANNOT READ');
                                          fnd_message.set_token('OPTION','GL_SET_OF_BKS_ID');
                                          fnd_message.error;
                                          raise form_trigger_failure;
end if;


open sob_cur(l_sob_id);
fetch sob_cur into l_sob_id,l_currency_code,l_coa_id;
close sob_cur;

:parameter.org_id := to_number(l_org_id);
:parameter.set_of_books_id := to_number(l_sob_id);
:parameter.currency_code := l_currency_code;
:parameter.chart_of_accounts_id := to_number(l_coa_id);

7.添加4个参数:
org_id、set_of_books_id、currency_code、chart_of_accounts_id

8.在WHEN-NEW-FORM-INSTANCE触发器中初始化Account弹性域:

fnd_key_flex.define(BLOCK=>'CUX_GL_JE_LINES',
                                   FIELD=>'ACCOUNT_DSP',
                                   APPL_SHORT_NAME=>'SQLGL',
                                   CODE=>'GL#',
                              NUM=>':PARAMETER.CHART_OF_ACCOUNTS_ID',
                              ID=>'CODE_COMBINATION_ID',
                         DESCRIPTION=>'ACCOUNT_DESCRIPTION',
                         VALIDATE=>'FULL',
                         updateable=>'ALL',
                         INSERTABLE=>'ALL',
                         DISPLAYABLE=>'ALL',
                                   REQUIRED=>'Y',                                                            
                                   VRULE=>'\\nSUMMAR Y_FLAG\\nI\\nAPPL=SQLGL;NAME=GL_NO_PARENT_SEGMENT_ALLOWED\\nN'
                                    );

账户键弹性域开发_第1张图片

你可能感兴趣的:(Oracle,EBS)