Oracle Report 使用 profile(fnd_porfile.value('ORG_ID'))
我們要在Report裡使用Profile有三件事情要先做
1.在User Parameter裡建立一個新的參數叫做P_CONC_REQUEST_ID
2.在Before Report Trigger裡呼叫 FND SRWINIT
FUNCTION beforereport
RETURN BOOLEAN IS
BEGIN
BEGIN
srw.USER_EXIT('FND SRWINIT');
EXCEPTION
WHEN srw.user_exit_failure THEN
srw.MESSAGE(3001, 'Error in SRWINIT');
RAISE;
END;
RETURN (TRUE);
END beforereport;
3.在After Report Trigger裡呼叫 FND SRWEXIT
FUNCTION afterreport
RETURN BOOLEAN IS
BEGIN
BEGIN
srw.USER_EXIT('FND SRWEXIT');
EXCEPTION
WHEN srw.user_exit_failure THEN
srw.MESSAGE(4001, 'Error in SRWEXIT');
END;
RETURN (TRUE);
END afterreport;
Reference
https://docs.oracle.com/cd/E26401_01/doc.122/e22961/T302934T458255.htm
https://docs.oracle.com/cd/E18727_01/doc.121/e12892/T354897T361281.htm
原因:The oracle standard report always use srw.user_exit ('FND SRWINIT') to get the previous session information depend on p_conc_request_id, and set the client session to be the same OU.Because the application is difference session with concurrent program.If you use fnd_profile.value(...) to get the profile.You may get the same OU ,eventhough you change OU. You can also get the correct OU by using definitoin of parameter to pass in report.