Overview:
This document help you to update Purchase Order using the API in oracle apps. Oracle has provided the common
API to update purchase order headers , lines and the distributions data.
API Name:
PO_CHANGE_API1_S.UPDATE_PO
Example:
-- Below example tested on R12.2.7 version
DECLARE
ln_result NUMBER;
lc_api_errors po_api_errors_rec_type;
ln_revision_num po_headers_all.revision_num%TYPE;
ln_price po_lines_all.unit_price%TYPE;
ln_quantity po_line_locations_all.quantity%TYPE;
lc_po_number po_headers_all.segment1%TYPE;
ln_line_num po_lines_all.line_num%TYPE;
ln_shipment_num po_line_locations_all.shipment_num%TYPE;
ld_promised_date DATE;
ld_need_by_date DATE;
ln_org_id NUMBER;
lc_context VARCHAR2(10);
BEGIN
FND_GLOBAL.apps_initialize (user_id => 54665,
resp_id => 55647,
resp_appl_id => 20002);
mo_global.init('PO'); -- need in R12
MO_GLOBAL.INIT ('PO'); -- MO_GLOBAL.INIT used for Multi org(OU), so we need to initialize for particular OU.
--- Initialize Variables ------------
lc_po_number := '77140178';
ln_line_num := 1;
ln_shipment_num := 1;
ln_revision_num := 0;
ld_promised_date := '24-MAR-2017';
ld_need_by_date := '24-MAR-2017';
ln_quantity := 200;
ln_price := 3.1;
ln_org_id := 102;
DBMS_OUTPUT.put_line ('Calling API To Update PO');
ln_result := APPS.PO_CHANGE_API1_S.UPDATE_PO
(x_po_number => lc_po_number,
x_release_number => NULL,
x_revision_number => ln_revision_num,
x_line_number => ln_line_num,
x_shipment_number => ln_shipment_num,
new_quantity => ln_quantity,
new_price => ln_price,
new_promised_date => ld_promised_date,
new_need_by_date => ld_need_by_date,
launch_approvals_flag => 'Y',
update_source => NULL,
version => '1.0',
x_override_date => NULL,
x_api_errors => lc_api_errors,
p_buyer_name => NULL,
p_secondary_quantity => NULL,
p_preferred_grade => NULL,
p_org_id => ln_org_id
);
DBMS_OUTPUT.put_line ('RESULT :' ||ln_result);
IF (ln_result = 1) THEN
DBMS_OUTPUT.put_line('Updating PO is Successful ');
ELSE
DBMS_OUTPUT.put_line ('Updating PO failed');
--
FOR j IN 1 .. lc_api_errors.MESSAGE_TEXT.COUNT
LOOP
DBMS_OUTPUT.put_line (lc_api_errors.MESSAGE_TEXT (j));
END LOOP;
--
END IF;
END;
/
** There is no any public API available for creating PO.
For creating Purchase Order refer below links:
Blanket Purchase Agreement -- https://sunilingole.blogspot.com/search/label/Blanket%20Purchase%20Agreement%20Interface%20OR%20Conversion%20in%20Oracle%20Apps%20R12.2.7
Blanket Release PO -- https://sunilingole.blogspot.com/search/label/Blanket%20Release%20Conversion
No comments:
Post a Comment