Thursday, August 12, 2010

Calling XML PO Report from PL/SQL



DECLARE
l_request_id NUMBER;
l_user_id NUMBER;
l_resp_id NUMBER;
l_resp_appl_id NUMBER;
l_call_status BOOLEAN;

BEGIN
SELECT fnd.user_id, fresp.responsibility_id, fresp.application_id
INTO l_user_id, l_resp_id, l_resp_appl_id
FROM apps.fnd_user fnd, apps.fnd_responsibility_tl fresp
WHERE fnd.user_name = 'CONVUSER'
AND fresp.responsibility_name = 'BR Purchasing SME';

apps.fnd_global.apps_initialize (l_user_id, l_resp_id, l_resp_appl_id);
mo_global.set_policy_context ('S', 102);

l_call_status :=
fnd_request.add_layout ('XXCUST', 'XXBRPRPOPRINT_XML', 'en', 'US', 'PDF');

l_request_id :=
fnd_request.submit_request
('XXCUST',
'XXBRPRPOPRINT_XML',
NULL,
NULL,
FALSE,
'R', --P_report_type
NULL, --P_agent_name_num
'114259', --P_po_num_from
'114259', --P_po_num_to
NULL, --P_release_num_from
NULL, --P_release_num_to
NULL, --P_date_from
NULL, --P_date_to
'Y', --P_approved_flag
'N', --P_test_flag
'N', --P_print_releases
NULL, --P_sortby
1171, --P_user_id
2, --P_qty_precision
'Y', -- P_fax_enable
222221, --P_fax_num
NULL, -- P_CANCEL_LINE
'Y', --P_BLANKET_LINES
'Y', -- P_email_enable
'abd@gmail.com', -- P_email_address
fnd_global.local_chr (0),
NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL
);
COMMIT;
DBMS_OUTPUT.put_line ('Request ID-'|| l_request_id);

EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.put_line (SQLERRM||'-'||SQLCODE);
END;

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.