Loading

Tuesday, June 15, 2010

API to Update Purchase Order Document (PO) (PO_CHANGE_API1_S.UPDATE_PO)

Below script will help you to update the purchase order document (PO) through API PO_CHANGE_API1_S.UPDATE_PO

This script was tested in R12.1.1 

SET SERVEROUTPUT ON;
DECLARE

v_result        NUMBER;
v_api_errors    po_api_errors_rec_type;

v_revision_num  po_headers_all.revision_num%TYPE;
v_price         po_lines_all.unit_price%TYPE;
v_quantity      po_line_locations_all.quantity%TYPE;
v_po_number     po_headers_all.segment1%TYPE;
v_line_num      po_lines_all.line_num%TYPE;
v_shipment_num  po_line_locations_all.shipment_num%TYPE;
v_promised_date DATE;
v_need_by_date  DATE;
v_org_id        NUMBER;

v_context       VARCHAR2(10);

FUNCTION set_context(   i_user_name    IN  VARCHAR2
                       ,i_resp_name    IN  VARCHAR2
                       ,i_org_id       IN  NUMBER)
  RETURN VARCHAR2
  IS
  BEGIN
  NULL;
  -- In order to reduce the content of the post I moved the implementation part of this function to another post and it is   available here 
  END set_context;
 
BEGIN

v_context := set_context ('&user', '&responsibility', 2038);

IF v_context = 'F'
   THEN
   DBMS_OUTPUT.PUT_LINE ('Error while setting the context');
END IF;

MO_GLOBAL.INIT ('PO');

--- context done ------------

v_po_number     := '20000063';
v_line_num      := 1;
v_shipment_num  := 1;
v_revision_num  := 0;
v_promised_date := '21-NOV-2009';
v_need_by_date  := '21-DEC-2009';
v_quantity      := 950;
v_price         := 10;
v_org_id        := 83;

DBMS_OUTPUT.put_line ('Calling API To Update PO');

v_result :=
    PO_CHANGE_API1_S.UPDATE_PO
         (x_po_number          => v_po_number,
          x_release_number     => NULL,
          x_revision_number    => v_revision_num,
          x_line_number        => v_line_num,
          x_shipment_number    => v_shipment_num,
          new_quantity         => v_quantity,
          new_price            => v_price,
          new_promised_date    => v_promised_date,
          new_need_by_date     => v_need_by_date,
          launch_approvals_flag=> 'Y',
          update_source        => NULL,
          VERSION              => '1.0',
          x_override_date      => NULL,
          x_api_errors         => v_api_errors,
          p_buyer_name         => NULL,
          p_secondary_quantity => NULL,
          p_preferred_grade    => NULL,
          p_org_id             => v_org_id
         );

DBMS_OUTPUT.put_line ('RESULT :' ||v_result);

IF (v_result = 1)
THEN
 DBMS_OUTPUT.put_line('Updating PO is Successful ');
ELSE
 DBMS_OUTPUT.put_line ('Updating PO failed');

 FOR j IN 1 .. v_api_errors.MESSAGE_TEXT.COUNT
 LOOP
 DBMS_OUTPUT.put_line (v_api_errors.MESSAGE_TEXT (j));
 END LOOP;
END IF;

END;

8 Responses to “API to Update Purchase Order Document (PO) (PO_CHANGE_API1_S.UPDATE_PO)”

vijayaraj said...
March 2, 2012 at 9:00 AM

Hi,
Can u let me know how to update the price and quantity on the standard PO from a file. I have some 100 lines. It would be of great help.

Thanks in advance


Anonymous said...
May 1, 2013 at 11:58 PM

Hi,

That's really nice work... I have a requirement to update PO Line quantity, when the line has multiple shipments. If I given the shipment number in the above api call, the qty is getting updated at shipment level and doesn't reflecting back the sum of shipment qty at PO Line level.

If I pass the shipment number as NULL, then it is giving the error message like below:

"To change the quantity or amount on a line with multiple shipments, you must also specify quantity or amount on one or more shipments".

It would be great, if you share some info.. on how to update PO Line qty in this case.

Thanks,
Sateesh


Karthikeyan D said...
May 23, 2013 at 12:58 AM

Hi,

My requirement is to Amenment Blanket Po Price
i tried with API NAME PO_CHANGE_API1_S.UPDATE_PO
Its working for Standard PO only i donot amenment Blanket Po.Its possible to amenment Balanket Po price Through API.

Can anyone suggest me.If its is possible Send me API Details

Thanks in Advance,

Regards,
karthikeyan.D


shankar said...
December 4, 2013 at 5:49 AM

I want to display Po Header details using Standard API.
and requisition header details through API.
Please tell me the API. I was searching from 10 days.....

Thanks in Advance,

Shankar


Anonymous said...
February 25, 2014 at 10:48 PM

i want to update only quantity on po...can u explian me with screen shorts


Anonymous said...
September 17, 2014 at 12:16 AM

Hi ,

Requirement details :

How to perform the Mass update on Purchase order from certain date onwards. From that date onwards we need to disconnect all the transactions like receiving and invoicing against purchase orders.

Can anyone suggest me.

Thanks


Vidya Ashok said...
April 10, 2015 at 7:31 AM

Hi,

Can anyone suggest how to update fields line agent_id, term_id, item_description using po_document_update_grp API. Provide pseudocodes if possible.

Thanks.


Sridevi Koduru said...
July 7, 2016 at 12:57 AM

Regards
Sridevi Koduru (Senior Oracle Apps Trainer Oracleappstechnical.com)
LinkedIn profile - https://in.linkedin.com/in/sridevi-koduru-9b876a8b


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.