/***************************************************************************************
* TYPE : Script *
* NAME : BACKORDER.sql *
* PURPOSE : The script will backorder the orders which are RTW status *
* *
* Author Date Ver Description *
* -------- ----------- ---- -------------------------- ---------------------------*
* XXXXXXX 02-Feb-2020 1.00 Created *
***************************************************************************************/
alter session set current_schema = apps;
SET SERVEROUTPUT ON;
SET SERVEROUTPUT ON SIZE 100000;
DECLARE
x_return_status VARCHAR2 (5000);
x_msg_count NUMBER;
x_msg_data VARCHAR2 (5000);
l_num_user_id NUMBER;
l_num_resp_id NUMBER;
l_num_resp_appl_id NUMBER;
CURSOR get_line_id
IS
SELECT DISTINCT wdd.move_order_line_id
FROM apps.wsh_delivery_details wdd, apps.oe_order_headers_all ooh
WHERE wdd.source_header_id = ooh.header_id
AND wdd.released_status = 'S' --Ready To Warehouse
--AND ooh.header_id in (137508997)
and wdd.organization_id = 331
and wdd.source_header_id in (135503888);
BEGIN
fnd_global.apps_initialize (11009, 67143, 20044);
FOR rec_get_line_id IN get_line_id
LOOP
INV_MO_BACKORDER_PVT.BACKORDER (rec_get_line_id.move_order_line_id,
x_return_status,
x_msg_count,
x_msg_data
);
COMMIT;
END LOOP;
EXCEPTION
WHEN OTHERS
THEN
DBMS_OUTPUT.put_line ('ERROR ' || SQLERRM);
END;
/