API to Approve the POs.

Introduction:

API to Approve the POs.

Cause of the issue:

In PO Migration from one unit to another unit, the old unit POs need to be approved. To update the same we can use the below API to approve the POs.

How do we solve:

The below is the API to Approve the Purchase Order without affecting the workflow.

Script:

DECLARE

l_return_status   VARCHAR2 (1000);

l_msg_data        VARCHAR2 (1000);

CURSOR c1

IS

(SELECT *

FROM po_headers_all

WHERE segment1 IN

(‘20202123569’, ‘2020200977’

)

AND type_lookup_code = ‘STANDARD’ and (authorization_status !=’APPROVED’ OR authorization_status IS NULL ));

BEGIN

mo_global.init (‘PO’);

fnd_global.apps_initialize (1130, 50743, 201);

 

FOR i IN c1

LOOP

po_document_action_pvt.do_approve

(p_document_id           => i.po_header_id,

p_document_type         => ‘PO’,

p_document_subtype      => ‘STANDARD’,

p_note                  => ”– Your comments that need to be displayed in action History,

p_approval_path_id      => 62,

x_return_status         => l_return_status,

x_exception_msg         => l_msg_data

);

DBMS_OUTPUT.put_line (l_return_status);

COMMIT;

END LOOP;

END;

Recent Posts

Start typing and press Enter to search