--sales Order Lines to backorder API
--===================================
--set serveroutput on size 1000000
DECLARE
L_return_status VARCHAR2 (100);
L_msg_count number;
L_msg_data VARCHAR2 (2000);
L_msg_index number;
L_USER_ID number;
L_RESP_ID number;
L_APPL_ID number;
L_ORG_ID Number: = &org_id;
L_MOVE_ORDER_LINE_ID number: = &mo_line_id;
BEGIN
SELECT user_id
Into l_user_id
From Fnd_user
WHERE user_name = ' SYSADMIN ';
SELECT responsibility_id
, application_id
Into l_resp_id
, l_appl_id
From FND_RESPONSIBILITY_VL
WHERE responsibility_name = ' Kw_all_ manufacturing and supply chain full responsibility ';
Fnd_global.apps_initialize (l_user_id, l_resp_id, l_appl_id);
Mo_global.set_policy_context (' S ', l_org_id);
--mo_global.init;
Dbms_output.put_line (' Calling Inv_mo_backorder_pvt to Backorder MO ');
Dbms_output.put_line (' =============================== ');
Inv_mo_backorder_pvt.backorder (p_line_id = l_move_order_line_id
, X_return_status = L_return_status
, X_msg_count = L_msg_count
, x_msg_data = L_msg_data);
Dbms_output.put_line (' Return Status is: ' | | l_return_status);
--Check Return Status
IF L_return_status = Fnd_api.g_ret_sts_success Then
Dbms_output.put_line (' Successfully backordered the ' Move Order line ');
COMMIT;
ELSE
Dbms_output.put_line (' Could not able-to-back Order line Due to following reasons ');
ROLLBACK;
for j in 1.. L_msg_count LOOP
Fnd_msg_pub.get (P_msg_index = j
, p_encoded = Fnd_api.g_false
, P_data = L_msg_data
, p_msg_index_out = L_msg_index);
Dbms_output.put_line (' Error Message is: ' | | l_msg_data);
END LOOP;
END IF;
END;
Oracle inv-so Line Backorder API