CREATE OR REPLACE TRIGGER XX_TRIGGER
AFTER UPDATE
ON TABLE_NAME
REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
WHEN (
NEW.ATTRIBUTE!=old.ATTRIBUTE and
NEW.VALUE!=OLD.VALUE)
DECLARE
l_appl_id NUMBER;
l_appl_name VARCHAR2 (100) := 'WIP';
l_user_id NUMBER;
l_user_name VARCHAR2 (100) := 'USER_NAME;
l_responsibility_id NUMBER;
l_resp_name VARCHAR2 (200) := 'WORK IN PROCESS';
ln_request_id NUMBER;
PRAGMA AUTONOMOUS_TRANSACTION;
BEGIN
-- To get the Application ID of given Application. ---- 401
SELECT application_id INTO l_appl_id FROM fnd_application
WHERE application_short_name = l_appl_name;
-- To get the User ID information of given user --
SELECT user_id INTO l_user_id FROM fnd_user
WHERE user_name = l_user_name;
-- To get the Resp ID information of the given responsibility.----
SELECT responsibility_id INTO l_responsibility_id FROM fnd_responsibility_tl
WHERE responsibility_name = l_resp_name AND application_id = l_appl_id and language='US';
--Initialixze the Application to use the API.
fnd_global.apps_initialize (l_user_id,l_responsibility_id , l_appl_id);
l_layout:= FND_REQUEST.add_layout(
template_appl_name => 'OM',
template_code => 'TEMPLATE_CODE',
template_language => 'en',
template_territory => '00',
output_format => 'PDF');
ln_request_id :=
fnd_request.submit_request ('WIP',--application_short_name
'XXABVCS',--conc prog short name
'XX WIP CONC PROGRAM',--description of conc program
NULL,
FALSE,
--parameter1
--parameter2
1150583
)
;
COMMIT;
/*IF ln_request_id = 0
THEN
DBMS_OUTPUT.PUT_LINE ('Concurrent Request Failed to Submit.');
ELSE
DBMS_OUTPUT.PUT_LINE('Successfully Submitted the Concurrent Request. Request Id: '||ln_request_id);
END IF;*/
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE('Error While Submitting Concurrent Request '||TO_CHAR(SQLCODE)||'-'||SQLERRM);
NULL;
END;
AFTER UPDATE
ON TABLE_NAME
REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
WHEN (
NEW.ATTRIBUTE!=old.ATTRIBUTE and
NEW.VALUE!=OLD.VALUE)
DECLARE
l_appl_id NUMBER;
l_appl_name VARCHAR2 (100) := 'WIP';
l_user_id NUMBER;
l_user_name VARCHAR2 (100) := 'USER_NAME;
l_responsibility_id NUMBER;
l_resp_name VARCHAR2 (200) := 'WORK IN PROCESS';
ln_request_id NUMBER;
PRAGMA AUTONOMOUS_TRANSACTION;
BEGIN
-- To get the Application ID of given Application. ---- 401
SELECT application_id INTO l_appl_id FROM fnd_application
WHERE application_short_name = l_appl_name;
-- To get the User ID information of given user --
SELECT user_id INTO l_user_id FROM fnd_user
WHERE user_name = l_user_name;
-- To get the Resp ID information of the given responsibility.----
SELECT responsibility_id INTO l_responsibility_id FROM fnd_responsibility_tl
WHERE responsibility_name = l_resp_name AND application_id = l_appl_id and language='US';
--Initialixze the Application to use the API.
fnd_global.apps_initialize (l_user_id,l_responsibility_id , l_appl_id);
l_layout:= FND_REQUEST.add_layout(
template_appl_name => 'OM',
template_code => 'TEMPLATE_CODE',
template_language => 'en',
template_territory => '00',
output_format => 'PDF');
ln_request_id :=
fnd_request.submit_request ('WIP',--application_short_name
'XXABVCS',--conc prog short name
'XX WIP CONC PROGRAM',--description of conc program
NULL,
FALSE,
--parameter1
--parameter2
1150583
)
;
COMMIT;
/*IF ln_request_id = 0
THEN
DBMS_OUTPUT.PUT_LINE ('Concurrent Request Failed to Submit.');
ELSE
DBMS_OUTPUT.PUT_LINE('Successfully Submitted the Concurrent Request. Request Id: '||ln_request_id);
END IF;*/
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE('Error While Submitting Concurrent Request '||TO_CHAR(SQLCODE)||'-'||SQLERRM);
NULL;
END;
No comments:
Post a Comment