Oracle Apps Cancel PO API Training
Following is a sample script to cancel the purchase order using Cancel PO API:
To cancel the whole PO, submit the cancel API using sqlplus as follows:
DECLARE
l_return_status VARCHAR2 (1);
BEGIN
fnd_global.apps_initialize (1053, 50578, 201);
-- mo_global.init('PO'); -- need for R12
--call the Cancel API for PO
PO_Document_Control_PUB.control_document (1.0, -- p_api_version
FND_API.G_TRUE, -- p_init_msg_list
FND_API.G_TRUE, -- p_commit
l_return_status, -- x_return_status
'PO', -- p_doc_type
'STANDARD', -- p_doc_subtype
NULL, -- p_doc_id
'23975', -- p_doc_num
NULL, -- p_release_id
NULL, -- p_release_num
NULL, -- p_doc_line_id
NULL, -- p_doc_line_num
NULL, -- p_doc_line_loc_id
NULL, -- p_doc_shipment_num
'CANCEL', -- p_action
SYSDATE, -- p_action_date
NULL, -- p_cancel_reason
'N', -- p_cancel_reqs_flag
NULL, -- p_print_flag
NULL); -- p_note_to_vendor
-- Get any messages returned by the Cancel API
FOR i IN 1 .. FND_MSG_PUB.count_msg
LOOP
DBMS_OUTPUT.put_line (
FND_MSG_PUB.Get (p_msg_index => i, p_encoded => 'F'));
END LOOP;
END;
The first run of the API will demonstrate cancelling shipment number 3 on line number 1 of the PO. Submit the cancel API using sqlplus as follows:
DECLARE
l_return_status VARCHAR2 (1);
BEGIN
fnd_global.apps_initialize (1053, 50578, 201);
-- mo_global.init('PO'); -- need for R12
--call the Cancel API for PO
PO_Document_Control_PUB.control_document (1.0, -- p_api_version
FND_API.G_TRUE, -- p_init_msg_list
FND_API.G_TRUE, -- p_commit
l_return_status, -- x_return_status
'PO', -- p_doc_type
'STANDARD', -- p_doc_subtype
NULL, -- p_doc_id
'23975', -- p_doc_num
NULL, -- p_release_id
NULL, -- p_release_num
NULL, -- p_doc_line_id
'1', -- p_doc_line_num
NULL, -- p_doc_line_loc_id
'3', -- p_doc_shipment_num
'CANCEL', -- p_action
SYSDATE, -- p_action_date
NULL, -- p_cancel_reason
'N', -- p_cancel_reqs_flag
NULL, -- p_print_flag
NULL); -- p_note_to_vendor
-- Get any messages returned by the Cancel API
FOR i IN 1 .. FND_MSG_PUB.count_msg
LOOP
DBMS_OUTPUT.put_line (
FND_MSG_PUB.Get (p_msg_index => i, p_encoded => 'F'));
END LOOP;
END;
This time, the API will be used to cancel all of line 1. Submit the cancel API using sqlplus as follows:
DECLARE
l_return_status VARCHAR2 (1);
BEGIN
fnd_global.apps_initialize (1053, 50578, 201);
-- mo_global.init('PO'); -- need for R12
--call the Cancel API for PO
PO_Document_Control_PUB.control_document (1.0, -- p_api_version
FND_API.G_TRUE, -- p_init_msg_list
FND_API.G_TRUE, -- p_commit
l_return_status, -- x_return_status
'PO', -- p_doc_type
'STANDARD', -- p_doc_subtype
NULL, -- p_doc_id
'23975', -- p_doc_num
NULL, -- p_release_id
NULL, -- p_release_num
NULL, -- p_doc_line_id
'1', -- p_doc_line_num
NULL, -- p_doc_line_loc_id
NULL, -- p_doc_shipment_num
'CANCEL', -- p_action
SYSDATE, -- p_action_date
NULL, -- p_cancel_reason
'N', -- p_cancel_reqs_flag
NULL, -- p_print_flag
NULL); -- p_note_to_vendor
-- Get any messages returned by the Cancel API
FOR i IN 1 .. FND_MSG_PUB.count_msg
LOOP
DBMS_OUTPUT.put_line (
FND_MSG_PUB.Get (p_msg_index => i, p_encoded => 'F'));
END LOOP;
END;
Following is a sample script to cancel the purchase order using Cancel PO API:
To cancel the whole PO, submit the cancel API using sqlplus as follows:
DECLARE
l_return_status VARCHAR2 (1);
BEGIN
fnd_global.apps_initialize (1053, 50578, 201);
-- mo_global.init('PO'); -- need for R12
--call the Cancel API for PO
PO_Document_Control_PUB.control_document (1.0, -- p_api_version
FND_API.G_TRUE, -- p_init_msg_list
FND_API.G_TRUE, -- p_commit
l_return_status, -- x_return_status
'PO', -- p_doc_type
'STANDARD', -- p_doc_subtype
NULL, -- p_doc_id
'23975', -- p_doc_num
NULL, -- p_release_id
NULL, -- p_release_num
NULL, -- p_doc_line_id
NULL, -- p_doc_line_num
NULL, -- p_doc_line_loc_id
NULL, -- p_doc_shipment_num
'CANCEL', -- p_action
SYSDATE, -- p_action_date
NULL, -- p_cancel_reason
'N', -- p_cancel_reqs_flag
NULL, -- p_print_flag
NULL); -- p_note_to_vendor
-- Get any messages returned by the Cancel API
FOR i IN 1 .. FND_MSG_PUB.count_msg
LOOP
DBMS_OUTPUT.put_line (
FND_MSG_PUB.Get (p_msg_index => i, p_encoded => 'F'));
END LOOP;
END;
The first run of the API will demonstrate cancelling shipment number 3 on line number 1 of the PO. Submit the cancel API using sqlplus as follows:
DECLARE
l_return_status VARCHAR2 (1);
BEGIN
fnd_global.apps_initialize (1053, 50578, 201);
-- mo_global.init('PO'); -- need for R12
--call the Cancel API for PO
PO_Document_Control_PUB.control_document (1.0, -- p_api_version
FND_API.G_TRUE, -- p_init_msg_list
FND_API.G_TRUE, -- p_commit
l_return_status, -- x_return_status
'PO', -- p_doc_type
'STANDARD', -- p_doc_subtype
NULL, -- p_doc_id
'23975', -- p_doc_num
NULL, -- p_release_id
NULL, -- p_release_num
NULL, -- p_doc_line_id
'1', -- p_doc_line_num
NULL, -- p_doc_line_loc_id
'3', -- p_doc_shipment_num
'CANCEL', -- p_action
SYSDATE, -- p_action_date
NULL, -- p_cancel_reason
'N', -- p_cancel_reqs_flag
NULL, -- p_print_flag
NULL); -- p_note_to_vendor
-- Get any messages returned by the Cancel API
FOR i IN 1 .. FND_MSG_PUB.count_msg
LOOP
DBMS_OUTPUT.put_line (
FND_MSG_PUB.Get (p_msg_index => i, p_encoded => 'F'));
END LOOP;
END;
This time, the API will be used to cancel all of line 1. Submit the cancel API using sqlplus as follows:
DECLARE
l_return_status VARCHAR2 (1);
BEGIN
fnd_global.apps_initialize (1053, 50578, 201);
-- mo_global.init('PO'); -- need for R12
--call the Cancel API for PO
PO_Document_Control_PUB.control_document (1.0, -- p_api_version
FND_API.G_TRUE, -- p_init_msg_list
FND_API.G_TRUE, -- p_commit
l_return_status, -- x_return_status
'PO', -- p_doc_type
'STANDARD', -- p_doc_subtype
NULL, -- p_doc_id
'23975', -- p_doc_num
NULL, -- p_release_id
NULL, -- p_release_num
NULL, -- p_doc_line_id
'1', -- p_doc_line_num
NULL, -- p_doc_line_loc_id
NULL, -- p_doc_shipment_num
'CANCEL', -- p_action
SYSDATE, -- p_action_date
NULL, -- p_cancel_reason
'N', -- p_cancel_reqs_flag
NULL, -- p_print_flag
NULL); -- p_note_to_vendor
-- Get any messages returned by the Cancel API
FOR i IN 1 .. FND_MSG_PUB.count_msg
LOOP
DBMS_OUTPUT.put_line (
FND_MSG_PUB.Get (p_msg_index => i, p_encoded => 'F'));
END LOOP;
END;
No comments:
Post a Comment