100%(1)100% found this document useful (1 vote) 288 views12 pagesPO Change API To Update Existing PO PDF
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here.
Available Formats
Download as PDF or read online on Scribd
er13r2018 Document 1078842.1
Copyright(c) 2019, Oracle, Al rights reserved, Orde Conigeti
n Demo - How To Use the PO Change API To Update Existing Purchase Orders (Doc ID
1078842,1)
In this Document
Goal
Solution
References
Oracle Purchasing - Version 11.5,10 to 12.2.4 [Release 11,5 to 12.2]
Information in this document applies to any platform.
What are the steps required in order to use the Change PO API to update a Standard Purchase Order ?
The example shown in this note is based on data in the Vision Demo database including User, Responsibility, Item, Inventory
Organization, Supplier, Site, etc.
NOTE: In the images below and/or the attached document, user details / company name / address / email / telephone
umber represent a fictitious sample (based upon made up data used in the Oracle Demo Vision instance). Any similarity
to actual persons, living or dead, is purely coincidental and not intended in any manner.
Login to the application using the seeded user/password Operations/welcome then Navigate to the Purchasing Responsibility :
Purchasing X00OOXX XXX
Navigate to the Purchase Order form and create a PO with a single line with quantity = 10, price = 1 and promised date = 31-
MAR-2010 (use any date in the future as long as itis in an open period). The Purchase Order screen will look like the following
screenshot
htps:isuppororacte.comlepmosiaces/DocumentDisplay?_adf cti-sale=j9d Boqs!_1288id=1078642.1 weer1312019 Document 1078842.1
ee on 2 ce
1. ene Ss
a
Querying the same PO through the PO Summary form, all the relevant line data can be seen :
htps:isuppororacte.comlepmosiaces/DocumentDisplay?_adf cti-sale=j9d Boqs!_1288id=1078642.1 22er1312019 Document 1078842.1
£7 SEO9H!?
3}
nt ite tee (my (ae UD |e na
(one —_‘prowucra io
Clicking on the Shipments button shows the relevant Shipment information :
htps:isuppororacte.comlepmosiaces/DocumentDisplay?_adf cti-sale=j9d Boqs!_1288id=1078642.1 aner1312019 Document 1078842.1
Penssttae firm _|sipT20s
ata maeae Vin Ope
|
Utilize this script to find the user_Id, responsibllty_Id and responsibility application_Id for the user.
select substr (fnd.user_name,X, XX),
fnd.user_id user id,
fru.responsibility i¢ resp_id,
fru,responsibility application id resp_appl_id,
fet responsibility are
ind_user fd,
End responsibility tl frt,
fnd_user resp groups direct fru
where
fndvuser_id = frususer_sd and
fetiresponsibility id = fru. responsibil
J id and
hps:isuppororacte.comlepmosiaces/DocumentDisplay?_adf cti-sale=j9d 1Boqs_1288id=1078642.1 4n2er13r2018 Document 1078842.1
End.ueez_name = ‘susex_name' and
fru.responsibility application id
x0;
‘The first run of the API will demonstrate updating the Quantity of Line 1 of the PO to 25. Submit the change API using sqlplus
as follows
set serveroutput ON?
DECLARE
A_resuit NUMBER;
_@rrors PO_API_BRRORS_REC_TYPE;
‘This needs to be changed according to your envizenment setup
FND_GLOBAL.apps_tnitialize { user_ld => XK,
resp_id => XXX,
resp_appl_id => XXX );
mo_giobalvinit ("Po"); ~~ reed for R12
1 Fesult i= PO_CHANGE APTI S.update_po (
X_PO_NUMBER => £po_num,
XORPEEASE_NUMBER => Wull,
XOREVISTON NUMBER => érev_num,
XCLINE_NUMBER => sLine_num,
XCSEIPHENT_NUMBPR => ashipment_num,
NEW_QUANTITY => 25,
NEW_PRICE => Nall,
NEW_PROMISED_DArE’ => NuIl,
NEN_NEED_BY_DATE -> wull,
LAUNCH_ABPROVALS_FLAG =>''w',
UPDATE SOURCE => ‘API',
VERSION => "1.0",
x oveanios pate “> Nutt,
XCAPE_ERRORS => + api_errors,
pLAUYER NAME => Null,
p secondary quantity => Null,
p preferred grade => Null,
plorg_id => sorg_id
a
dbrs_output.put_tine ("2 result? [| 1_resulth;
ie (result © 1) THEN
Display the errors
FOR i IN 1..1_ap!_errors.message_text COUNT L00P
abrs_output.pat_tine ( 1_api_errors.message_text (1) 17
END LOOP;
END Ty
END;
Querying the PO line again in the PO Summary form shows :
a Wee_1286id=1078642.1 sizer1312019 Document 1078842.1
LAIR G'?
sey _[oumy cw
“The second run of the API will demonstrate updating the Price of Line 1 of the PO to 0.9. Submit the change API using sqlplus
as follows :
set serveroutput ON
A_result NUMBER:
api _errors PO APT_BRRORS RFC TYEE;
BEGIN
‘This needs to be changed according to your environment setup.
FND_GLOBAL.apps initialize ( user id -> XXX,
Sp id => XXXXE,
resp appl id => 3006 }
no_global-inke (180°):
A zesult
need for R12
PO_CHANGE_APT1_S.update_po (
hps:isupperoracte.comlepmosiaces/DocumentDisplay?_adf cti-sale=j9d 1Boqs!_1288id=1078642.1
anaer13r2018 Document 1078842.1
X_PO_NUMBER => Epo_num,
XORELEASE NUMBER => Null,
XOREVISION_NUMBER => gzey_num,
XOLINE NUMBER => Eline num,
XOSETPHENT NUMBER => 43h!prent_num,
NEN_QUANTITY => wWull,
NEW_PRICE => 0.9,
NER_PROMISED_DATE => Null,
NER_NEED BY DATE => Null,
LAUNCH _ABPROVALS FLAG =>
upDaTE_souRCE => "API",
VERSION => ‘1.0",
X_OVERRIDE_DATE “> wull,
XCAPI_ERRORS => + api_errors,
pLBUYER NAME => NOLL,
Plsecondary_quantizy => Nell,
plpreterred grade => Null,
plorg id => sorg id
YF
dbrs_output.put_tine ("1 result? [| 1_resulty
TF (1_geeule <1) THEN
Display the errors
FOR i IN 1..1_ap!_errors.messaga_text COUNT LOOP
fdbrs_output.pat_tine ( 1 api_errrs.message_text (1) }7
END Lor;
END TF?
END:
Requerying the PO line shows that the price has been changed as expected :
a Wee_1286id=1078642.1 meer1312018 Document 1078842.1
SB POU SOSH ED Hy BOOFH!?
|
inte ce (own [uh ce
io
ew
‘The third run of the API will demonstrate updating the Promised Date of Shipment 1 (of Line 1) of the PO to 30-Mar-2010.
‘Submit the change API using sqlplus as follows :
set serveroutput ON
A_result NUMBER;
api _errors PO APT_BRRORS RFC TYEE;
BEGIN
‘This needs to be changed according to your environment setup.
FND_GLOBAL.apps initialize { user id => XO,
Sp id => XXXKE,
resp appl id => 3006 }
no_global-inke (180°):
A zesult
need for R12
PO_CHANGE_APT1_S.update_po (
hps:isupperoracte.comlepmosiaces/DocumentDisplay?_adf cti-sale=j9d 1Boqs_1288id=1078642.1
aner13r2018 Document 1078842.1
X_PO_NUMBER => Epo_num,
XCRELEASE NUMBER => Null,
XOREVISION NUMBER => ézey_num,
XOLINE NUMBER => Eline num,
XOSHTPHENT NUMBER => 4sh!prent_num,
NEW_QUANTTTY => Null,
NEW_PRICE => Null
NEW_PROMTSED_DATE => TO DATE (TO_CHAR(*30-Mar-2010") , *DD-MON-YYYY"),
NEW_NSED_BY_BATE => Null,
LAUNCH _ADPROVALS FLAG =>" 'N',
UbDAPE_SOURCE => "API",
VERSION => *1.0",
X_OVERRIDE_DATE “> wull,
XCAPI_ERRORS api_errors,
PLBUYER_NAME => NOLL,
Plsecondary_quantizy => Nell,
plpreterred grade => Null,
plorg id => sorg id
YF
dbrs_output.put_tine (*1_result? [| 1_resulty;
TF (1_geeule <1) THEN
c= Display the errors
FOR i IN 1..1_ap!_errors.messaga_text COUNT LOOP
fdbrs_output.pat_tine ( 1 api_errars.message_text (1) }7
END Lor;
END TF?
END:
Querying the PO Shipment from the PO Summary form shows that the update was successful :
a
ZO VOSA AP LS VAT SBT,
te
Baqsl_1288id=1078842.1
pen
onaer13r2018 Document 1078842.1
The following information from Page 131 of the Oracle Manufacturing APIs and Open Interfaces Manual explains setting the
‘org context :
Setting Context
Prior to calling the API you should set your global context to reflect the application, user and responsibility used to perform
the change action. If you do not set this context, the API will not be able to identify or update your data. If you are calling the
{API from an environment that already has the context set you do not need to set it again.
The call that may be used to set the global context is: fnd_global.apps_initialize(user_id, resp_id, resp_application_id); user_id
is an FND_USER who would be allowed to perform the change action. Resp_id is the id of the responsibilty that is being used
to modify the document. This id will also set the context for the operating unit for the document being updated.
Debugging:
Turning on debugging and tracing during the API call - from the sqlplus session:
x_id, @respon_id, 100%);
¥");
‘exec fnd_profile.put (‘APLOG_LEVEL", ‘1');
exec fnd profile put (‘APLOG_PILENAME', '");
exec fnd_log_repository-init();
alter session set sql_trace=TRUE
ALTER SESSION SET TRACEFILE_IDENTIFIER='change_api_trace’ EVENTS ‘10046 TRACE NAME CONTEXT FOREVER,
LEVEL 12°;
is needs to be changed according to your er
Guosks.apps instialsee (seer id => XXX,
Fesp_ia > 10008,
Pesplappiid -> 1
no globe need for Ri2
1 resuit ATI Swupaavepo
YCREEEASE. WMBER ~> Tu
XCREVISTON NUMBER =>
(Shrpisnt. NUMBER => ¢Shipsent_num,
ww guaNst#Y => soil,
wewpaace => 1
NEW_FROMESED_DATS “> TO_DRTE(TO_CIAR(*30-Mar=2010"), 1DO-HON-YYYY")
sources => "aT",
VERSION => "1.0",
psecondary. quantity => Null,
ioms_outpst pat_tine result
If (resule © 1) THEN
ext .COUNT L00P
fessage_text (1) 7
‘sion set sql_trace=FALSE
htps:isuppororacte.comlepmosiaces/DocumentDisplay?_adf cti-stale=j9d 1Boqs!_1288id=1078642.1 soner13r2018
Here is an example of the API callin release 12,
set feedback on
pet term on
sel serveroutput on
DECLARE
A result NUMBER;
Aapi_errors PO_API_GRRORS_REC TYPE:
BEGIN
fnd_global.apps,
mo_global-init (7E0"};
mo_glopal.set_po2:
ontext ("5") 1000) +
a_result
PO_CHANGE_ APTI,
(x_po_nunber => XXX,
x Felease_nunber => NULL,
xorevision number => 0,
xoline number => 1,
xoshipment_nunber “> 1,
ew quantity => 25,
new price => nul!
new promised date => null,
new_need by date => null,
lauich_approvals fag=> null,
update source => NULL,
VERSTOR => '1.0',
x override date “> NUL,
xcapi_errors => 1_api_errors,
pobuyer_nans => NOLL,
PLsecondary_quantizy => NULL,
P preferred grade —> NULL,
plorg id => Xxx
is
TP (result © 1) THEN
== display the erro:
FOR i IN L..1_ap.
abrs_output -pat,
END Loop;
S.UPDATE_po
/
pitialize (200000, 000%, 1000 +
Document 1078842.1
text .cOUNT LooP
Tne ( 1 api_errore.message_text (i) )7
‘The Oracle Manufacturing APIS and Open Interfaces Manual can be found in Note 67108.1.
For more Vision Demo Notes, please see Note 1075748.1 : Vision Demo Document Index Procurement)
‘There is an enhancement request to introduce more fields into the API so that it is more robust and functional.
‘Bug 9837561 - ER: ENHANCE PO CHANGE API TO SUPPORT ADDITIONAL FIELDS
Please vote on the ideas in the Oracle Community.
hhttps://community oracle,comyideas/19139
htps:isuppororacte.comlepmosiaces/DocumentDisplay?_adf cti-sale=j9d Boqs!_1288id=1078642.1
nieer13r2018 Document 1078842.1
hhttps://community.oracle.com/ideas/1360
REFERENCES
Vision Demo Document Index (Procurement)
+
Didn't find what you are looking for?
htps:isuppororacte.comlepmosiaces/DocumentDisplay?_adf cti-sale=j9d Boqs!_1288id=1078642.1 rane
You might also like
Oracle R12 Financials (GL, AP, AR, CE, FA, MOAC and EB Tax) Training Manual
Oracle R12 Financials (GL, AP, AR, CE, FA, MOAC and EB Tax) Training Manual
209 pages
AP, Ar, GL, Inv, Pa, Fa, Po, Tca, Workflow - Interface and Base Table in Oracle Apps r12 - Oracle Apps Guide
AP, Ar, GL, Inv, Pa, Fa, Po, Tca, Workflow - Interface and Base Table in Oracle Apps r12 - Oracle Apps Guide
5 pages