Wednesday, January 25, 2017

API to Update Purchase Requisition in Oracle Apps R12 (PO_REQUISITION_UPDATE_PUB.update_requisition)














In this post, i have shared a sample script for updating the purchase requisition. 

As per Oracle Documentation, this API can be used to update PR with status INCOMPLETE or APPROVED only. But, i tried to update a INPROCESS PR and it worked :) .

API: PO_REQUISITION_UPDATE_PUB.update_requisition

Tested Instance: R12

Script:


DECLARE
  lrec_req_hdr      PO_REQUISITION_UPDATE_PUB.req_hdr;
  ltab_req_line_tbl PO_REQUISITION_UPDATE_PUB.req_line_tbl;
  ltab_req_dist_dtl PO_REQUISITION_UPDATE_PUB.req_dist_tbl;
  lv_return_status  VARCHAR2(1);
  ln_msg_count      NUMBER;
  lv_msg_data       VARCHAR2(2000);
 
BEGIN
 
  lrec_req_hdr.requisition_header_id             := 115001;
  lrec_req_hdr.org_id                            := 85;
  ltab_req_line_tbl(1).requisition_header_id     := 115001;
  ltab_req_line_tbl(1).requisition_line_id       := 126332;
  ltab_req_line_tbl(1).suggested_vendor_name     := 'SHARE_ORACLE';
  ltab_req_line_tbl(1).suggested_vendor_location := 'SHARE_ORACLE_LOC';
 
  PO_REQUISITION_UPDATE_PUB.update_requisition
  (p_init_msg_list   => 'T',
   p_commit          => 'F',
   x_return_status   => lv_return_status,
   x_msg_count       => ln_msg_count,
   x_msg_data        => lv_msg_data,
   p_submit_approval => 'N',
   p_req_hdr         => lrec_req_hdr,
   p_req_line_tbl    => ltab_req_line_tbl,
   p_req_dist_tbl    => ltab_req_dist_dtl
   );
 
  DBMS_OUTPUT.PUT_LINE('Return Status :' || lv_return_status);
  DBMS_OUTPUT.PUT_LINE('Msg Count :' || ln_msg_count);
  DBMS_OUTPUT.PUT_LINE('Msg Data :' || lv_msg_data);
 
END;


Hope this helps!!

 
 





3 Responses to “API to Update Purchase Requisition in Oracle Apps R12 (PO_REQUISITION_UPDATE_PUB.update_requisition)”

Satya Das said...
April 23, 2017 at 6:52 AM

Problem: My Requisition line is getting updated but the Requisition is going in "In-Complete" Status. I do not want to change requisition status & it should remain in status as "APPROVED".


Anonymous said...
May 4, 2017 at 6:25 AM

Hi Satya,

That is not possible to update the PR without changing the status. Eventhough it is not recommended, sometime simple backend table update works :)

Regards,#
Team Search


Unknown said...
August 22, 2017 at 3:29 PM

Hi will this work for an Internal Requisition as well?


Post a Comment

Disclaimer

The ideas, thoughts and concepts expressed here are my own. They, in no way reflect those of my employer or any other organization/client that I am associated. The articles presented doesn't imply to any particular organization or client and are meant only for knowledge Sharing purpose. The articles can't be reproduced or copied without the Owner's knowledge or permission.