Steps:
Create Move Order and approve --> Allocate Qty to move order lines --> Run API to transact material from the allocated sub inventory
DECLARE
p_org_id NUMBER := &p_org_id;
p_invorg_id NUMBER := &p_invorg_id;
p_sales_order_num VARCHAR2 (200) := &p_sales_order_num;
l_api_version NUMBER := 1.0;
l_init_msg_list VARCHAR2 (2) := FND_API.G_TRUE;
l_commit VARCHAR2 (2) := FND_API.G_FALSE;
x_return_status VARCHAR2 (2);
x_msg_count NUMBER := 0;
x_msg_data VARCHAR2 (20000);
l_return_status VARCHAR2 (2);
l_msg_data VARCHAR2 (255);
l_idx NUMBER := 0;
l_from_date DATE;
l_to_date DATE;
-- API variable declarations
l_move_order_type NUMBER := 1;
l_transaction_mode NUMBER := 1;
l_tmoline_tbl INV_MOVE_ORDER_PUB.trolin_tbl_type;
l_mold_tbl INV_MO_LINE_DETAIL_UTIL.g_mmtt_tbl_type;
x_mmtt_tbl INV_MO_LINE_DETAIL_UTIL.g_mmtt_tbl_type;
x_trolin_tbl INV_MOVE_ORDER_PUB.trolin_tbl_type;
l_transaction_date DATE := SYSDATE;
CURSOR trans_move_order_cur (cp_org_id NUMBER,
cp_inv_org_id NUMBER,
cp_order_num VARCHAR2)
IS
SELECT oola.line_id,
oola.line_number,
wdd.released_status,
wdd.move_order_line_id,
oola.ship_from_org_id
FROM oe_order_lines_all oola,
wsh_delivery_details wdd,
org_organization_definitions mtlp,
hr_operating_units hou
WHERE 1 = 1
AND mtlp.operating_unit = cp_org_id
AND mtlp.operating_unit = hou.organization_id
AND hou.organization_id = cp_org_id
AND mtlp.organization_id =
NVL (cp_inv_org_id, mtlp.organization_id)
AND wdd.organization_id = mtlp.organization_id
AND wdd.source_code = 'OE'
AND wdd.source_line_id = oola.line_id
AND wdd.released_status = 'S'
AND wdd.oe_interfaced_flag = 'N'
AND wdd.inv_interfaced_flag = 'N'
AND oola.flow_status_code = 'AWAITING_SHIPPING'
AND EXISTS
(SELECT '1'
FROM ont.oe_order_headers_all ooha
WHERE header_id = wdd.source_header_id
AND ooha.order_number + 0 =
NVL (cp_order_num, ooha.order_number));
TYPE trans_move_order_tab IS TABLE OF trans_move_order_cur%ROWTYPE;
cr_move_order_tbl trans_move_order_tab;
BEGIN
fnd_global.apps_initialize (fnd_global.user_id, fnd_global.resp_id, 665); -- 665-- WSH
OPEN trans_move_order_cur (p_org_id, p_invorg_id, p_sales_order_num);
FETCH trans_move_order_cur BULK COLLECT INTO cr_move_order_tbl;
CLOSE trans_move_order_cur;
DBMS_OUTPUT.put_line (
'Orders -- move from Released to Warehouse to Ship Confirm');
FOR i IN 1 .. cr_move_order_tbl.COUNT
LOOP
l_tmoline_tbl (l_idx).line_id :=
cr_move_order_tbl (i).move_order_line_id;
l_idx := NVL (l_tmoline_tbl.COUNT, 0) + 1;
END LOOP;
IF (l_tmoline_tbl.COUNT > 0)
THEN
INV_PICK_WAVE_PICK_CONFIRM_PUB.Pick_Confirm (
p_api_version_number => l_api_version,
p_init_msg_list => l_init_msg_list,
p_commit => l_commit,
x_return_status => x_return_status,
x_msg_count => x_msg_count,
x_msg_data => x_msg_data,
p_move_order_type => l_move_order_type,
p_transaction_mode => l_transaction_mode,
p_trolin_tbl => l_tmoline_tbl,
p_mold_tbl => l_mold_tbl,
x_mmtt_tbl => x_mmtt_tbl,
x_trolin_tbl => x_trolin_tbl,
p_transaction_date => l_transaction_date);
IF (x_return_status <> FND_API.G_RET_STS_SUCCESS)
THEN
DBMS_OUTPUT.put_line ('Message count: ' || x_msg_count);
IF (x_msg_count > 1)
THEN
FOR i IN 1 .. x_msg_count
LOOP
x_msg_data :=
fnd_msg_pub.get (p_msg_index => i,
p_encoded => FND_API.G_FALSE);
DBMS_OUTPUT.put_line ('message :' || x_msg_data);
END LOOP;
END IF;
END IF;
END IF;
COMMIT;
EXCEPTION
WHEN OTHERS
THEN
DBMS_OUTPUT.put_line (
'Error in XX_WSH_TRANSACT_MOVE_ORDER_PKG.' || SQLERRM);
END;
Create Move Order and approve --> Allocate Qty to move order lines --> Run API to transact material from the allocated sub inventory
DECLARE
p_org_id NUMBER := &p_org_id;
p_invorg_id NUMBER := &p_invorg_id;
p_sales_order_num VARCHAR2 (200) := &p_sales_order_num;
l_api_version NUMBER := 1.0;
l_init_msg_list VARCHAR2 (2) := FND_API.G_TRUE;
l_commit VARCHAR2 (2) := FND_API.G_FALSE;
x_return_status VARCHAR2 (2);
x_msg_count NUMBER := 0;
x_msg_data VARCHAR2 (20000);
l_return_status VARCHAR2 (2);
l_msg_data VARCHAR2 (255);
l_idx NUMBER := 0;
l_from_date DATE;
l_to_date DATE;
-- API variable declarations
l_move_order_type NUMBER := 1;
l_transaction_mode NUMBER := 1;
l_tmoline_tbl INV_MOVE_ORDER_PUB.trolin_tbl_type;
l_mold_tbl INV_MO_LINE_DETAIL_UTIL.g_mmtt_tbl_type;
x_mmtt_tbl INV_MO_LINE_DETAIL_UTIL.g_mmtt_tbl_type;
x_trolin_tbl INV_MOVE_ORDER_PUB.trolin_tbl_type;
l_transaction_date DATE := SYSDATE;
CURSOR trans_move_order_cur (cp_org_id NUMBER,
cp_inv_org_id NUMBER,
cp_order_num VARCHAR2)
IS
SELECT oola.line_id,
oola.line_number,
wdd.released_status,
wdd.move_order_line_id,
oola.ship_from_org_id
FROM oe_order_lines_all oola,
wsh_delivery_details wdd,
org_organization_definitions mtlp,
hr_operating_units hou
WHERE 1 = 1
AND mtlp.operating_unit = cp_org_id
AND mtlp.operating_unit = hou.organization_id
AND hou.organization_id = cp_org_id
AND mtlp.organization_id =
NVL (cp_inv_org_id, mtlp.organization_id)
AND wdd.organization_id = mtlp.organization_id
AND wdd.source_code = 'OE'
AND wdd.source_line_id = oola.line_id
AND wdd.released_status = 'S'
AND wdd.oe_interfaced_flag = 'N'
AND wdd.inv_interfaced_flag = 'N'
AND oola.flow_status_code = 'AWAITING_SHIPPING'
AND EXISTS
(SELECT '1'
FROM ont.oe_order_headers_all ooha
WHERE header_id = wdd.source_header_id
AND ooha.order_number + 0 =
NVL (cp_order_num, ooha.order_number));
TYPE trans_move_order_tab IS TABLE OF trans_move_order_cur%ROWTYPE;
cr_move_order_tbl trans_move_order_tab;
BEGIN
fnd_global.apps_initialize (fnd_global.user_id, fnd_global.resp_id, 665); -- 665-- WSH
OPEN trans_move_order_cur (p_org_id, p_invorg_id, p_sales_order_num);
FETCH trans_move_order_cur BULK COLLECT INTO cr_move_order_tbl;
CLOSE trans_move_order_cur;
DBMS_OUTPUT.put_line (
'Orders -- move from Released to Warehouse to Ship Confirm');
FOR i IN 1 .. cr_move_order_tbl.COUNT
LOOP
l_tmoline_tbl (l_idx).line_id :=
cr_move_order_tbl (i).move_order_line_id;
l_idx := NVL (l_tmoline_tbl.COUNT, 0) + 1;
END LOOP;
IF (l_tmoline_tbl.COUNT > 0)
THEN
INV_PICK_WAVE_PICK_CONFIRM_PUB.Pick_Confirm (
p_api_version_number => l_api_version,
p_init_msg_list => l_init_msg_list,
p_commit => l_commit,
x_return_status => x_return_status,
x_msg_count => x_msg_count,
x_msg_data => x_msg_data,
p_move_order_type => l_move_order_type,
p_transaction_mode => l_transaction_mode,
p_trolin_tbl => l_tmoline_tbl,
p_mold_tbl => l_mold_tbl,
x_mmtt_tbl => x_mmtt_tbl,
x_trolin_tbl => x_trolin_tbl,
p_transaction_date => l_transaction_date);
IF (x_return_status <> FND_API.G_RET_STS_SUCCESS)
THEN
DBMS_OUTPUT.put_line ('Message count: ' || x_msg_count);
IF (x_msg_count > 1)
THEN
FOR i IN 1 .. x_msg_count
LOOP
x_msg_data :=
fnd_msg_pub.get (p_msg_index => i,
p_encoded => FND_API.G_FALSE);
DBMS_OUTPUT.put_line ('message :' || x_msg_data);
END LOOP;
END IF;
END IF;
END IF;
COMMIT;
EXCEPTION
WHEN OTHERS
THEN
DBMS_OUTPUT.put_line (
'Error in XX_WSH_TRANSACT_MOVE_ORDER_PKG.' || SQLERRM);
END;
No comments:
Post a Comment