Note: We had a requirement to delete Purchase Orders which are in INCOMPLETE status during migration. Please check with oracle or your team for your requirement. This is just to give some idea. Do not execute in production.
DECLARE
l_result BOOLEAN;
BEGIN
FOR i IN (SELECT po_header_id
,type_lookup_code
FROM po_headers_all
WHERE authorization_status = 'INCOMPLETE'
AND org_id = 12345)
LOOP
DBMS_OUTPUT.put_line ( 'API PO_HEADERS_SV1 Call to delete PO with header :'||i.po_header_id);
l_result := po_headers_sv1.delete_po (x_po_header_id => i.po_header_id
,x_type_lookup_code => i.type_lookup_code
,p_skip_validation => 'N'
);
IF l_result = TRUE THEN
COMMIT;
DBMS_OUTPUT.put_line ( 'PO with header: '|| i.po_header_id||',Deleted Successfully');
ELSE
ROLLBACK;
DBMS_OUTPUT.put_line ( 'PO with header: '|| i.po_header_id||',Failed to Delete');
END IF;
END LOOP;
DBMS_OUTPUT.put_line ( 'Deletion Process Over');
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.put_line ( 'Error : '|| SQLERRM);
END;
No comments:
Post a Comment