1 Reply Latest reply on Jun 28, 2016 8:31 PM by 3222393

    Multiple PO Line cancellations through API

    3222393

      Hi Friends, We are trying to cancel multiple PO lines on the same Standard Purchase Order using PO_DOCUMENT_CONTROL_PUB.CONTROL_DOCUMENT API in a loop. But as soon as the first line is cancelled the PO moves in to 'IN PROCESS' status (PO_HEADERS_ALL.AUTHORIZATION_STATUS) preventing further line cancellations.

       

      The PO however moves back to 'APPROVED' status after 2 minutes, this delay is causing the next lines from cancellation and throwing the error "The specified control action (Action = CANCEL) is invalid for this document.".

       

      This issue is observed even after submitting the workflow background process from the package after each PO line cancellation API call. We are currently on R12.1.3 of EBiz suite.

       

      Any pointers on how this requirement can be achieved/was achieved would be appreciated. Thanks in advance.

       

      Sample snippet for reference:

      po_document_control_pub.control_document

                     (

                       p_api_version       =>   '1.0',

                       p_init_msg_list     =>   FND_API.G_TRUE,

                       p_commit            =>   FND_API.G_TRUE,

                       x_return_status     =>   lv_return_status ,

                       p_doc_type          =>   'PO',

                       p_doc_subtype       =>   'STANDARD',

                       p_doc_id            =>   rec_cur_po_line_cancel.po_header_id,

                       p_doc_num           =>   NULL,

                       p_release_id        =>   NULL,

                       p_release_num       =>   NULL,

                       p_doc_line_id       =>   NULL,

                       p_doc_line_num      =>   rec_cur_po_line_cancel.line_num,

                       p_doc_line_loc_id   =>   NULL,

                       p_doc_shipment_num  =>   NULL,

                       p_action            =>   'CANCEL',

                       p_action_date       =>   SYSDATE,

                       p_cancel_reason     =>    'Cancelled By Source',

                       p_cancel_reqs_flag  =>   NULL,

                       p_print_flag        =>   'N',

                       p_note_to_vendor    =>   NULL,

                       p_use_gldate        =>   NULL,

                       p_org_id            =>   pv_org_id

                     );

       

      Thanks,

      Vineeth