Submit Concurrent Program From Backend
DECLARE
l_responsibility_id NUMBER;
l_application_id NUMBER;
l_user_id NUMBER;
l_request_id NUMBER;
xml_layout boolean;
gc_wait_interval NUMBER := 0;
v_wait BOOLEAN;
v_phase VARCHAR2 (10);
v_status VARCHAR2 (10);
-- v_out VARCHAR2 (200);
-- v_out1 VARCHAR2 (200);
-- po_err_msg VARCHAR2 (1000);
v_dev_phase VARCHAR2 (200);
v_dev_status VARCHAR2 (200);
v_message VARCHAR2 (200);
-- v_lay BOOLEAN;
-- v_cnt NUMBER;
cursor c1 is
select vendor_site_code, VENDOR_ID P_CUSTOMER_NAME from ap_supplier_sites_all
where vendor_site_code in (
)
and ORG_ID = 82;
BEGIN
SELECT DISTINCT fr.responsibility_id,
frx.application_id
INTO l_responsibility_id,
l_application_id
FROM apps.fnd_responsibility frx,
apps.fnd_responsibility_tl fr
WHERE fr.responsibility_id = frx.responsibility_id
AND LOWER (fr.responsibility_name) LIKE LOWER('SD Seller Inv Analyst');
SELECT user_id INTO l_user_id
FROM fnd_user WHERE user_name = 'TECH.TEAM';
--To set environment context.
apps.fnd_global.apps_initialize (l_user_id,l_responsibility_id,l_application_id);
--Submitting Concurrent Request
FOR I IN C1 loop
xml_layout := fnd_request.add_layout ('XXSD',
'XXSDCOMMINV',
'en',
'US',
'PDF'
);
gc_wait_interval := 10;
l_request_id := fnd_request.submit_request (
'XXSD' ---- application
, 'XXSDCOMMINV' --- program_SHORT _NAME
, '' --- description
, '' ---start_time
, FALSE --- sub_request
, I.P_CUSTOMER_NAME --P_CUSTOMER_NAME
, NULL --Invoice_NUMBER
, NULL --- TRANSACTION_TYPE
, '10301' ---P_TERM_ID
, 'Monthly' ---P_DATE_TYPE
, '2016/04/01 00:00:00' ---P_FROM_DATE
, '2016/04/30 00:00:00' ---P_TO_DATE
, 'No' ---P_EMAIL_BUR
, '82' ---P_ORG_ID
);
COMMIT;
v_wait :=
fnd_concurrent.wait_for_request (request_id => l_request_id,
INTERVAL => gc_wait_interval,
phase => v_phase,
status => v_status,
dev_phase => v_dev_phase,
dev_status => v_dev_status,
MESSAGE => v_message
);
fnd_file.put_line (fnd_file.LOG,
'User Phase code and status code.'
|| v_phase
|| v_status
|| l_request_id
|| v_dev_phase
|| v_dev_status
);
IF l_request_id = 0
THEN
dbms_output.put_line ('Concurrent request failed to submit');
dbms_output.put_line (I.P_CUSTOMER_NAME||' ------DONE-------');
ELSE
dbms_output.put_line(SQLCODE||' Successfully Submitted the Concurrent Request '||SQLERRM);
END IF;
END LOOP;
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line('Error While Submitting Concurrent Request '||TO_CHAR(SQLCODE)||'-'||sqlerrm);
END;
l_responsibility_id NUMBER;
l_application_id NUMBER;
l_user_id NUMBER;
l_request_id NUMBER;
xml_layout boolean;
gc_wait_interval NUMBER := 0;
v_wait BOOLEAN;
v_phase VARCHAR2 (10);
v_status VARCHAR2 (10);
-- v_out VARCHAR2 (200);
-- v_out1 VARCHAR2 (200);
-- po_err_msg VARCHAR2 (1000);
v_dev_phase VARCHAR2 (200);
v_dev_status VARCHAR2 (200);
v_message VARCHAR2 (200);
-- v_lay BOOLEAN;
-- v_cnt NUMBER;
cursor c1 is
select vendor_site_code, VENDOR_ID P_CUSTOMER_NAME from ap_supplier_sites_all
where vendor_site_code in (
)
and ORG_ID = 82;
BEGIN
SELECT DISTINCT fr.responsibility_id,
frx.application_id
INTO l_responsibility_id,
l_application_id
FROM apps.fnd_responsibility frx,
apps.fnd_responsibility_tl fr
WHERE fr.responsibility_id = frx.responsibility_id
AND LOWER (fr.responsibility_name) LIKE LOWER('SD Seller Inv Analyst');
SELECT user_id INTO l_user_id
FROM fnd_user WHERE user_name = 'TECH.TEAM';
--To set environment context.
apps.fnd_global.apps_initialize (l_user_id,l_responsibility_id,l_application_id);
--Submitting Concurrent Request
FOR I IN C1 loop
xml_layout := fnd_request.add_layout ('XXSD',
'XXSDCOMMINV',
'en',
'US',
'PDF'
);
gc_wait_interval := 10;
l_request_id := fnd_request.submit_request (
'XXSD' ---- application
, 'XXSDCOMMINV' --- program_SHORT _NAME
, '' --- description
, '' ---start_time
, FALSE --- sub_request
, I.P_CUSTOMER_NAME --P_CUSTOMER_NAME
, NULL --Invoice_NUMBER
, NULL --- TRANSACTION_TYPE
, '10301' ---P_TERM_ID
, 'Monthly' ---P_DATE_TYPE
, '2016/04/01 00:00:00' ---P_FROM_DATE
, '2016/04/30 00:00:00' ---P_TO_DATE
, 'No' ---P_EMAIL_BUR
, '82' ---P_ORG_ID
);
COMMIT;
v_wait :=
fnd_concurrent.wait_for_request (request_id => l_request_id,
INTERVAL => gc_wait_interval,
phase => v_phase,
status => v_status,
dev_phase => v_dev_phase,
dev_status => v_dev_status,
MESSAGE => v_message
);
fnd_file.put_line (fnd_file.LOG,
'User Phase code and status code.'
|| v_phase
|| v_status
|| l_request_id
|| v_dev_phase
|| v_dev_status
);
IF l_request_id = 0
THEN
dbms_output.put_line ('Concurrent request failed to submit');
dbms_output.put_line (I.P_CUSTOMER_NAME||' ------DONE-------');
ELSE
dbms_output.put_line(SQLCODE||' Successfully Submitted the Concurrent Request '||SQLERRM);
END IF;
END LOOP;
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line('Error While Submitting Concurrent Request '||TO_CHAR(SQLCODE)||'-'||sqlerrm);
END;
Comments
Post a Comment