3 Replies Latest reply on Apr 10, 2015 3:46 AM by Sanjay Desai EBS

    Close open PO from the Backend.

    A.T

      Hi Guru's

       

                       How can we close the open PO from the backend with Zero dollar. As I understood PO_action.po_close would be the solution but can we close the Open PO without using API is there any script to close please share it I highly appreciate your help

       

      Thanks & regards

      AT

        • 1. Re: Close open PO from the Backend.
          A.T

          Please advise how to close Open PO with Zero dollar ?

           

          Thanks

          AT

          • 2. Re: Close open PO from the Backend.
            User579817-OC

            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;



            Reference:Oracle Apps Cancel PO API Training | Oracle Apps Scripts & Tips

            • 3. Re: Close open PO from the Backend.
              Sanjay Desai EBS

              Pl. review the following MOS doc.

               

              How can Purchase Orders (POs) be mass closed through the use of an API? " section in FAQ - PO Document Control [ID 1261814.1].

              Bug 4711021 : SAME AS 4264508? CANNOT CLOSE PO USING PO_ACTIONS.CLOSE_PO

              Bug 2709015 : MASS CANCEL AND MASS CLOSE OF PURCHASE ORDERS