、首先在FORM中引入 FNDCONC.pll
2、调用请求,并等待请求完成,附代码如下:
PROCEDURE BTN_CLICK(p_btn_name varchar2) is
X_REQ_ID NUMBER;
L_PHASE_CODE VARCHAR2(1);
L_STATUS_CODE VARCHAR2(1);
START_DATE DATE;
CUR_DATE DATE;
DUMMY VARCHAR2(10);
P_USER_ID VARCHAR2(30) :=FND_PROFILE.VALUE('USER_ID');
l_result boolean;
BEGIN
l_result := fnd_request.add_layout(
template_appl_name => 'CUX',
template_code => 'CUXGLCASHFLOWS',
template_language => null,
template_territory => null,
output_format => 'PDF'
);
X_REQ_ID := fnd_request.submit_request( 'CUX'
,'CUXGLCASHFLOWS'
,''
,''
,FALSE
,'8000'
,'2001'
,'2009-06'
,'CNY'
,chr(0)
,'','','','','','','','','','','','','','',
'',
'',
'',
'',
'',
'',
'',
'',
'','','',
'','','','','','','','','','',
'','','','','','','','','','',
'','','','','','','','','','',
'','','','','','','','','','',
'','','','','','','','','','',
'','','','','','','','','','',
'','','','','','','','','','');
IF X_REQ_ID = 0 THEN
FND_MESSAGE.set_string('请求提交失败');
FND_MESSAGE.ERROR;
ELSE
COMMIT;
FND_MESSAGE.SET_STRING('请求已提交,请等待');
FND_MESSAGE.show;
END IF;
SELECT SYSDATE
INTO START_DATE
FROM DUAL;
DBMS_LOCK.SLEEP(7);
LOOP
SELECT A.PHASE_CODE,
A.STATUS_CODE,
SYSDATE
INTO
L_PHASE_CODE,
L_STATUS_CODE,
CUR_DATE
FROM FND_CONC_REQ_SUMMARY_V A
WHERE A.REQUEST_ID = X_REQ_ID;
EXIT WHEN (L_PHASE_CODE = 'C' AND L_STATUS_CODE = 'C') OR (CUR_DATE - START_DATE)>= 0.002400;
DBMS_LOCK.SLEEP(7);
END LOOP;
EDITOR_PKG.REPORT(X_REQ_ID, 'Y');
END BTN_CLICK;