Below API can be used for Oracle apps Requisition cancellation.
DECLARE
v_requisition_header_id po_requisition_headers_all.requisition_header_id%TYPE;
v_requisition_line_id po_requisition_lines_all.requisition_line_id%TYPE;
v_REQ_HEADER_ID PO_TBL_NUMBER;
v_REQ_LINE_ID PO_TBL_NUMBER;
v_msg VARCHAR2(1000);
x_returnstatus VARCHAR2(10);
x_msgcount NUMBER;
x_msgdata VARCHAR2(200);
BEGIN
FND_GLOBAL.APPS_INITIALIZE(
user_id => 43867 -- User ID
, resp_id => 20707 -- Order Management Super User
, resp_appl_id => 201 -- Oracle Order Management
);
MO_GLOBAL.INIT('PO');
mo_global.set_policy_context('S', 101);
FOR i IN (SELECT
prh.requisition_header_id,
prl.requisition_line_id
FROM
apps.po_requisition_lines_all prl
where <desired conditions .. >
)
LOOP
v_requisition_header_id := i.requisition_header_id;
v_requisition_line_id := i.requisition_line_id;
--
v_REQ_HEADER_ID := PO_TBL_NUMBER(v_requisition_header_id);
v_REQ_LINE_ID := PO_TBL_NUMBER(v_requisition_line_id);
--Cancelling the requisition
po_req_document_cancel_grp.cancel_requisition(p_api_version => 1.0,
p_req_header_id => v_REQ_HEADER_ID,
p_req_line_id => v_REQ_LINE_ID,
p_cancel_date => SYSDATE,
p_cancel_reason => 'QTY shipped',
p_source => NULL,
x_return_status => x_returnstatus,
x_msg_count => x_msgcount,
x_msg_data => x_msgdata);
END LOOP;
END;
COMMIT;
/
DECLARE
v_requisition_header_id po_requisition_headers_all.requisition_header_id%TYPE;
v_requisition_line_id po_requisition_lines_all.requisition_line_id%TYPE;
v_REQ_HEADER_ID PO_TBL_NUMBER;
v_REQ_LINE_ID PO_TBL_NUMBER;
v_msg VARCHAR2(1000);
x_returnstatus VARCHAR2(10);
x_msgcount NUMBER;
x_msgdata VARCHAR2(200);
BEGIN
FND_GLOBAL.APPS_INITIALIZE(
user_id => 43867 -- User ID
, resp_id => 20707 -- Order Management Super User
, resp_appl_id => 201 -- Oracle Order Management
);
MO_GLOBAL.INIT('PO');
mo_global.set_policy_context('S', 101);
FOR i IN (SELECT
prh.requisition_header_id,
prl.requisition_line_id
FROM
apps.po_requisition_lines_all prl
where <desired conditions .. >
)
LOOP
v_requisition_header_id := i.requisition_header_id;
v_requisition_line_id := i.requisition_line_id;
--
v_REQ_HEADER_ID := PO_TBL_NUMBER(v_requisition_header_id);
v_REQ_LINE_ID := PO_TBL_NUMBER(v_requisition_line_id);
--Cancelling the requisition
po_req_document_cancel_grp.cancel_requisition(p_api_version => 1.0,
p_req_header_id => v_REQ_HEADER_ID,
p_req_line_id => v_REQ_LINE_ID,
p_cancel_date => SYSDATE,
p_cancel_reason => 'QTY shipped',
p_source => NULL,
x_return_status => x_returnstatus,
x_msg_count => x_msgcount,
x_msg_data => x_msgdata);
END LOOP;
END;
COMMIT;
/