Total Pageviews

September 25, 2015

9/25/2015 05:18:00 AM
The PO_Document_Control_PUB.control_document () PL/SQL procedure provides the ability to cancel Purchasing documents directly through an API.
 
DECLARE
   l_return_status   VARCHAR2 (1);
BEGIN
   fnd_global.apps_initialize (user_id, resp_id, resp_application_id);
   --call the Cancel API
   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
                                             'PO123',             -- 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;