How to approve PO from backend in oracle apps.PO approval api in oracle apps
oracle approve purchase order API
DECLARE
v_item_key
VARCHAR2(100);
Cursor purchase_order is
SELECT
pha.po_header_id,
pha.org_id,
pha.segment1,
pha.agent_id,
pdt.document_subtype,
pdt.document_type_code,
pha.authorization_status
FROM apps.po_headers_all pha, apps.po_document_types_all pdt
WHERE pha.type_lookup_code = pdt.document_subtype
AND pha.org_id = pdt.org_id
AND pdt.document_type_code = 'PO'
AND authorization_status in ('INCOMPLETE', 'REQUIRES REAPPROVAL')
AND segment1 = '4456666'; -- Enter the Purchase Order Number
BEGIN
fnd_global.apps_initialize (user_id => 1234,
resp_id => 124432,
resp_appl_id => 201);
FOR i IN purchase_order
LOOP
mo_global.set_policy_context ('S', ‘85’);
SELECT p_rec.po_header_id '-' to_char(po_wf_itemkey_s.NEXTVAL)
INTO v_item_key FROM dual;
dbms_output.put_line (' Calling po_reqapproval_init1.start_wf_process for
po_id=>' i.segment1);
po_reqapproval_init1.start_wf_process(
ItemType => 'POAPPRV'
, ItemKey => v_item_key
, WorkflowProcess => 'POAPPRV_TOP'
, ActionOriginatedFrom => 'PO_FORM'
, DocumentID => i.po_header_id -- po_header_id
, DocumentNumber => i.segment1 -- Purchase Order Number
, PreparerID => i.agent_id -- Buyer/Preparer_id
, DocumentTypeCode => i.document_type_code--'PO'
, DocumentSubtype => i.document_subtype --'STANDARD'
, SubmitterAction => 'APPROVE'
, forwardToID => NULL
, forwardFromID => NULL
, DefaultApprovalPathID => NULL
, Note => NULL
, PrintFlag => 'N'
, FaxFlag => 'N'
, FaxNumber => NULL
, EmailFlag => 'N'
, EmailAddress => NULL
, CreateSourcingRule => 'N'
, ReleaseGenMethod => 'N'
, UpdateSourcingRule => 'N'
, MassUpdateReleases => 'N'
, RetroactivePriceChange => 'N'
, OrgAssignChange => 'N'
, CommunicatePriceChange => 'N'
, p_Background_Flag => 'N'
, p_Initiator => NULL
, p_xml_flag => NULL
, FpdsngFlag => 'N'
, p_source_type_code => NULL);
commit;
DBMS_OUTPUT.PUT_LINE ('Purchase Order has been approved=>' i.segment1);
END LOOP;
END;
How to approve PO from backend in oracle apps.PO approval api in oracle apps
Cursor purchase_order is
SELECT
pha.po_header_id,
pha.org_id,
pha.segment1,
pha.agent_id,
pdt.document_subtype,
pdt.document_type_code,
pha.authorization_status
FROM apps.po_headers_all pha, apps.po_document_types_all pdt
WHERE pha.type_lookup_code = pdt.document_subtype
AND pha.org_id = pdt.org_id
AND pdt.document_type_code = 'PO'
AND authorization_status in ('INCOMPLETE', 'REQUIRES REAPPROVAL')
AND segment1 = '4456666'; -- Enter the Purchase Order Number
BEGIN
fnd_global.apps_initialize (user_id => 1234,
resp_id => 124432,
resp_appl_id => 201);
FOR i IN purchase_order
mo_global.set_policy_context ('S', ‘85’);
SELECT p_rec.po_header_id '-' to_char(po_wf_itemkey_s.NEXTVAL)
INTO v_item_key FROM dual;
dbms_output.put_line (' Calling po_reqapproval_init1.start_wf_process for po_id=>' i.segment1);
po_reqapproval_init1.start_wf_process(
ItemType => 'POAPPRV'
, ItemKey => v_item_key
, WorkflowProcess => 'POAPPRV_TOP'
, ActionOriginatedFrom => 'PO_FORM'
, DocumentID => i.po_header_id -- po_header_id
, DocumentNumber => i.segment1 -- Purchase Order Number
, PreparerID => i.agent_id -- Buyer/Preparer_id
, DocumentTypeCode => i.document_type_code--'PO'
, DocumentSubtype => i.document_subtype --'STANDARD'
, SubmitterAction => 'APPROVE'
, forwardToID => NULL
, forwardFromID => NULL
, DefaultApprovalPathID => NULL
, Note => NULL
, PrintFlag => 'N'
, FaxFlag => 'N'
, FaxNumber => NULL
, EmailFlag => 'N'
, EmailAddress => NULL
, CreateSourcingRule => 'N'
, ReleaseGenMethod => 'N'
, UpdateSourcingRule => 'N'
, MassUpdateReleases => 'N'
, RetroactivePriceChange => 'N'
, OrgAssignChange => 'N'
, CommunicatePriceChange => 'N'
, p_Background_Flag => 'N'
, p_Initiator => NULL
, p_xml_flag => NULL
, FpdsngFlag => 'N'
, p_source_type_code => NULL);
DBMS_OUTPUT.PUT_LINE ('Purchase Order has been approved=>' i.segment1);
END LOOP;
END;
0 comments:
Post a Comment