--- 提交处理事务处理接口请求
l_request_id := FND_REQUEST.SUBMIT_REQUEST(
APPLICATION => 'INV',
PROGRAM => 'INCTCM'
);
IF ( l_request_id = 0 ) THEN
RAISE E_SUBMIT_FAILED;
RETURN;
ELSE
COMMIT;
L_REQUEST_FLAG := FND_CONCURRENT.WAIT_FOR_REQUEST(
REQUEST_ID => L_REQUEST_ID,
INTERVAL => 5,
MAX_WAIT => 0,
PHASE => L_PHASE,
STATUS => L_STATUS,
DEV_PHASE => L_DEV_PHASE,
DEV_STATUS => L_DEV_STATUS,
MESSAGE => L_MESSAGE
);
END IF;
COMMIT;
EXCEPTION
WHEN E_SUBMIT_FAILED THEN
ERRCODE := '1';
ERRMSG := '提交处理事务处理接口请求失败!'||SUBSTR(SQLERRM,1,100);
FND_FILE.PUT_LINE(FND_FILE.LOG,ERRMSG);
ROLLBACK;
RETURN;
END;
今天关注到这个问题,将找到的资料收集在这里:
1、关于fnd_request.submit_request的用法
fnd_request.submit_request的用法:
FND_REQUEST.SUBMIT_REQUEST 函數是用來提交一個請求的,它返回一個NUMBER值.具體調用如下
:result := fnd_request.submit_request(application CHAR, --AP模快
program CHAR, --應用程式
description CHAR, --請求說明(可選)
start_time CHAR, --RUN 時間(可選)
sub_request BOOLEAN, --立刻提交請求
argument1 CHAR, --參數1
argument2 CHAR, --參數2
argument3 CHAR, --參數3
argument4 CHAR, --參數4
argument5 CHAR, --參數5.......
argument100 CHAR);
英文說明(zt oracle) :
Parameters are as follows:
application - Short name of the application associated with the concurrent
request to be submitted.
program - Short name of the concurrent program (not the executable) for which
the request should be submitted.
description - Description of the request that is displayed in the Concurrent
Requests form (Optional.)
start_time - Time at which the request should start running, formatted as HH24:
MI or HH24:MI:SS (Optional.)
sub_request - Set to TRUE if the request is submitted from another request and
should be treated as a sub-request.
argument1...100 - Arguments for the concurrent request; up to 100
arguments are permitted. If submitted from Oracle Forms, you must specify all
100 arguments.
补充说明:
在用fnd_request.submit_request的时候,第五个参数用false,不要被参数名称误导;
这个函数有105个参数,前面五个定义请求本身,后面100个是传递给请求的具体参数,都是Char类型,
我们需要转换,默认值是chr(0),代表这个参数不用传递给调用的请求;
在Package里面调用只需要传递需要的参数个数,因为它有默认值指示结束;
在form里面则不行,要写满105个,而且我们参数结束之后要用一个chr(0)来表示结束
例
fnd_request.submit_request('AR',
'SVAINEX_P',
'',
'',
FALSE,
:parameter.invoice_store,
chr(0),
'','','',
'','','','','','','','','','','','','','','','','','','','',
'','','','','','','','','','','','','','','','','','','','',
'','','','','','','','','','','','','','','','','','','','',
'','','','','','','','','','','','','','','','','','','','',
'','','','','','','','','','','','','','','');
<span style="color: rgb(0, 0, 255);"><span style="color: rgb(0, 0, 0);">例子:当:trx_controls.site_use_code = 'BILL_TO' 时,对于 bill_to_customer_name的LOV使用的SQL为 select *</span></span>
<span style="color: rgb(0, 0, 255);"><span style="color: rgb(0, 0, 0);"> from XXX1;</span></span>
<span style="color: rgb(0, 0, 255);"><span style="color: rgb(0, 0, 0);">当:trx_controls.site_use_code = 'SHIP_TO' 时,对于 bill_to_customer_name的LOV使用的SQL为 select *</span></span><pre code_snippet_id="227796" snippet_file_name="blog_20140310_4_3859357" class="plsql" name="code" style="color: rgb(51, 51, 51); white-space: pre-wrap; word-wrap: break-word;"><span style="color: rgb(0, 0, 255);"><span style="color: rgb(0, 0, 0);"> from XXX2;</span></span>
<span style="color: rgb(0, 0, 255);"><span style="color: rgb(0, 0, 0);">实现:</span></span>
<span style="color: rgb(0, 0, 255);"><span style="color: rgb(0, 0, 0);">1)为bill_to_customer_name创建一个基本的LOV(常规LOV,用LOV向导创建)bill_to_customer_lov,在LOV创建过程中明确查询出的列,返回值等 2)在记录组中创建 bill_to_group,ship_to_group</span></span>
<span style="color: rgb(0, 0, 255);"><span style="color: rgb(0, 0, 0);"> 注:记录组查询的列需要与基本LOV的相同,这样才能在更换记录组后根据基本LOV的设置将相应的项返回给相应的值 SQL分别为 select * from XXX1; select * from XXX2;</span></span>
<span style="color: rgb(0, 0, 255);"><span style="color: rgb(0, 0, 0);">3)创建trigger bill_to_customer_name下创建when_new_item_instance触发器 添加代码: IF :trx_controls.site_use_code = 'BILL_TO' THEN</span></span>
<span style="color: rgb(0, 0, 255);"><span style="color: rgb(0, 0, 0);"> SET_LOV_PROPERTY( 'BILL_TO_CUSTOMERS_LOV', GROUP_NAME, 'BILL_TO_GROUP' );</span></span>
<span style="color: rgb(0, 0, 255);"><span style="color: rgb(0, 0, 0);">ELSIF :trx_controls.site_use_code = 'SHIP_TO' THEN</span></span>
<span style="color: rgb(0, 0, 255);"><span style="color: rgb(0, 0, 0);"> SET_LOV_PROPERTY( 'BILL_TO_CUSTOMERS_LOV', GROUP_NAME, 'SHIP_TO_GROUP' );</span></span>
<span style="color: rgb(0, 0, 255);"><span style="color: rgb(0, 0, 0);">END IF;</span></span>
procedure line_num ( event varchar2) is l_line_num_count number;begin if ( event = 'WHEN-VALIDATE-ITEM') then if :lines.line_number <= 0 then fnd_message.set_name('XHU','XHU_ALL_ENTER_VALUE_GT_ZERO'); fnd_message.error; raise form_trigger_failure; end if; -- check the unique line number from DB if xhu_orders_sv.po_line_num_exists(name_in('headers.header_id'),name_in('lines.line_number')) then fnd_message.set_name('XUH','XHU_ENTER_UNIQUE_LINE_NUM'); fnd_message.error; raise form_trigger_failure; end if; elsif (event = 'WHEN-CREATE-RECORD') then :lines.line_number := :parameter.max_line_num + 1; elsif (event = 'PRE-QUERY') then -- get the maximums line number from the DB :parameter.max_line_num := xhu_orders_sv.get_max_line_num(name_in('headers.header_id')); elsif (event = 'WHEN-VALIDATE-RECORD') then if :lines.line_number > :parameter.max_line_num then :parameter.max_line_num := :lines.line_number ; end if; elsif (event = 'WHEN-NEW-RECORD-INSTANCE')then if upper(get_block_property('lines',status)) = upper('NEW') and :System.Mode <> 'ENTER-QUERY' then :parameter.max_line_num := xhu_orders_sv.get_max_line_num(name_in('headers.header_id')); line_num('WHEN-CREATE-RECORD'); SET_RECORD_PROPERTY(get_block_property('lines',current_record), 'lines', STATUS, NEW_STATUS ); end if; else APP_EXCEPTION.INVALID_ARGUMENT('LINE_NUMBER', 'EVENT', EVENT); end if; exceptionwhen others THEN raise;end line_num;
--headers:单据的头数据块--lines:行号所属的数据块--xhu_orders_sv.get_max_line_num:根据头ID取得数据库中单据的最大行号--XHU_ENTER_UNIQUE_LINE_NUM:消息字典:请输入唯一行号--XHU_ALL_ENTER_VALUE_GT_ZERO:消息字典:请输入大于0的值
各触发器的HANDLER:procedure when_create_record isbegin lines.line_num('WHEN-CREATE-RECORD'); end when_create_record; procedure when_new_record_instance isbegin lines.line_num('WHEN-NEW-RECORD-INSTANCE');end when_new_record_instance; procedure when_validate_record isbegin lines.line_num('WHEN-VALIDATE-RECORD'); end when_validate_record; procedure pre_query isbegin lines.line_num('PRE-QUERY');end pre_query;
app_item_property.set_property('trx_headers.import_flag', UPDATEABLE, PROPERTY_OFF );
set_record_property(:system.trigger_record, :system.cursor_block, STATUS, QUERY_STATUS); --其中STATUS包括 insert_status,new_status,query_status
日期从、至查询数据块trx_headers_qf设置gl_date_from、gl_date_to属性:数据类型—Date 最大长度—12,查询长度—255添加触发器KEY-LISTVAL,内容为calendar.show;被查询的数据块trx.headers.query_find;内容为:App_find.query_find('MAIN_WIN', 'HEADERS_QF_WIN', 'TRX_HEADERS_QF'); trx_headers.pre_query;内容为:PROCEDURE pre_query IS BEGIN if :parameter.G_QUERY_FIND = 'TRUE' then copy(:TRX_HEADERS_QF.bill_to_customer_id,'trx_headers.bill_to_customer_id'); app_find.query_range(:trx_headers_qf.trx_number_from,:trx_headers_qf.trx_number_to,'trx_headers.trx_number'); app_find.query_range(:trx_headers_qf.gl_date_from,:trx_headers_qf.gl_date_to,'trx_headers.gl_date'); :parameter.G_QUERY_FIND := 'FALSE'; end if; END;注:检查trx_headers.gl_date的查询长度,需要设置为255,否则在点击‘FIND’后会报错
用户最多可以定义45个form-level 的trigger ,名称必须为SPECIALn,其中SPECIAL1 to SPECIAL15属于Tools菜单项,SPECIAL16 to SPECIAL30属于Reports菜单项, SPECIAL31 to SPECIAL45属于Actions菜单项, 其中Reports、Actions的名称可以被修改。1)在pre_form中添加app_special.instantiate('SPECIAL1', '&Find', 'bkord');参数1为触发器名称,参数2为显示的菜单项内容,参数3为图标样式,参数4、参数5有默认值2)在form级别创建SPECIAL1触发器,实现该菜单项内容例如:app_custom.open_window('HEADERS_QF_WIN');go_block('TRX_HEADERS_QF');
右键菜单也可以自定义,form-level PRE-POPUP-MENU trigger 引用APPSTAND.EVENT('PRE-POPUP-MENU')建立default menu;建立block /item level pre-pop-menutrigger须(Execution Hierarchy ->After)。从block /item level pre-pop-menu trigger(Execution Hierarchy ->After)中调用app_popup.instantate函数初始化右键菜单项:procedure APP_POPUP.INSTANTIATE(option_name varchar2,txt varchar2, initially_enabled boolean default true,separator varchar2 default null);