Oracle has provided standard API to update purchase order line details such as;
- Line Quantity
- Unit Price
- Promise Date
- Need by Date
Below is the sample script to update PO Line details using API "po_change_api1_s.update_po".
SET serveroutput ON
DECLARE
v_po_number NUMBER :='52766';
v_po_line_num NUMBER :=1;
v_quantity NUMBER :=200;
v_unit_price NUMBER :=5;
v_promise_date DATE :=SYSDATE;
v_need_by_date DATE :=SYSDATE;
v_org_id NUMBER :=204 ;
v_revision_num NUMBER;
v_error_flag NUMBER :=0;
v_error_msg VARCHAR2(2000);
v_result NUMBER;
BEGIN
--------INITIALIZING APPS ENVIRONMENT-------------------------------
apps.mo_global.init ('PO');
apps.mo_global.set_policy_context ('S',204);
apps.fnd_global.apps_initialize ( user_id => 1318, resp_id => 50578, resp_appl_id => 201 );
----GET REVISION NUMBER FROM TABLE-------
BEGIN
SELECT revision_num
INTO v_revision_num
FROM apps.po_headers_all
WHERE segment1 = '52766';
exception
WHEN no_data_found THEN
v_error_flag := 1;
v_error_msg:='ERROR IN FETCHING REVISION NUMBER FROM BASE TABLE (ND) ';
WHEN others THEN
v_error_flag := 1;
v_error_msg:='ERROR IN FETCHING REVISION NUMBER FROM BASE TABLE (OTH) '||sqlcode||' '||sqlerrm;
END;
IF (v_error_flag <> 1) THEN
--------CALLING PO UPDATE API--------
v_result := apps.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_po_line_num,
x_shipment_number => 1,
new_quantity => v_quantity,
new_price => v_unit_price,
new_promised_date => v_promise_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);
COMMIT;
IF(v_result = 1) THEN
dbms_output.put_line('PO UPDATED SUCCESSFULLY');
ELSE
dbms_output.put_line('API Failed to Update');
END IF;
END IF;
exception
WHEN others THEN
v_error_msg := 'ERROR in updating PO Lines';
END ;
I wish to show thanks to you just for bailing me out of this particular trouble. As a result of checking through the net and meeting techniques that were not productive, Same as your blog I found another one Oracle Fusion Financials .Actually I was looking for the same information on internet for Oracle Fusion Financials and came across your blog. I am impressed by the information that you have on this blog. Thanks once more for all the details.
ReplyDelete