Wednesday, December 24, 2008

PO Update APIs po_change_api1_s.update_po

It is quite often to update some of the lines of a PO after it is approved.
In order to Update a PO, we can use the API po_change_api1_s.update_po.

It Update a standard purchase order or release changes of quantity, price, promise date and Need-by-date.This Need-by-date updation with this API has been enhanced in R12 only. In earlier releases updating the PO line’s Need-by-date is not available.

Psudo code of the usage
l_result := po_change_api1_s.update_po
(x_po_number => p_po_num ,
x_release_number => NULL ,
x_revision_number => l_revision_no,
x_line_number => lines_rec.line_num,
x_shipment_number => lines_rec.shipment_num,
new_quantity => NULL,
new_price => NULL,
new_promised_date => NULL ,
new_need_by_date => TO_DATE(nedbydate,'DD-MON-RRRR'),
launch_approvals_flag => 'N' ,
update_source => NULL,
VERSION => '1.0',
x_api_errors => l_api_errors,
p_buyer_name => Lines_rec.agent_name,
p_secondary_quantity => NULL,
p_preferred_grade => NULL,
p_org_id => g_org_id);

It will either return a 1 for successful update or 0 for failure.

Pre-requisites to use this API
1) PO header to be either in APPROVED or REQUIRES REAPPROVAL status.
2) No update if the revision number doesn't match the current revision.
Post Update
1)Upon successful updation,the PO revision will be incremented.
2) if launch_approvals_flag is set to 'Y' then it will launch the PO Approval. But if you set this parameter as 'Y' then the program try to submit the PO Approval for every successful update of the line.Most of the time this Approval will not update the PO to APPROVED, it may be delay waiting for some other input, so it will make the PO status as INPROCESS.
So please avoid to launch the Po Approval with this Update PO API.
3)The authorization status of the PO will be in REQUIRES REAPPROVAL is the above paramter is set to 'N'

Difficulties faced:
1) This will update the PO if it have one line without any issue in the first run.
2) If the PO have more than one line, then we need to run the Update program the no.of lines po have.We need to pass the Po line num for every run.
3)If the first PO line got updated then revision will gets chnaged to next highest number.So we need to grab the revision number for every updated line and need to input to the above program.
4) By doing this we can avoid the weird error 'The revision number doesn't match the current revision'.
5)Need to launch the PO approval manually because it will leave teh PO in REQUIRES REAPPROVAL state.

8 comments:

Anonymous said...

Hi,

You mention that manual PO approval is needed:
5)Need to launch the PO approval manually because it will leave teh PO in REQUIRES REAPPROVAL state.

What API should I use for that?

In my case LAUNCH_APPROVALS_FLAG = 'Y' seems to work fine with standard orders but not with blanket order releases. Here I need manual approval (trough some API).

ss_reenu said...

Hi,

We are using some custom code to call this API. But it is returnig status as 0 with the error message "API message 1: - Version 10 is an invalid version since it is higher than version 1 of the UPDATE_PO defined in Package PO_CHANGE_API1_S. The version numbers should be the same to be valid."
Do you habe any clue on this and how to resolve it

Vyaghresh said...

Which version of EBS you are using and which column you are trying to update with this API.

Anonymous said...

Hi,

Have you used this API to update price of a Blanket Purchase Order Line ? I am facing difficulties doing it

Unknown said...

Hi

We have a requirement to update the need_by_date using po_change_api1_s.update_po API with a timestamp. However when we pass the needby date with timestamp, the timestamp changes to 00:00:00 inthe backened. Any ideas on how to achieve this.

Thanks and regrds
Naveen

Anonymous said...

HI,

Can we change the item against the existing PO line???
by any of method

Anonymous said...

Hi,
Can we update the promise date to NULL with this API. If YES, then what we need to give as input for promise date.
FND_API.G_MISS_DATE is not working, I mean it is not clearing the date.

Kindly help.

Unknown said...

Hi I have a requirement to update acceptance_required_flag in PO headers..any suggestion on what API I need to use