100% found this document useful (1 vote)
328 views3 pages

Allocate Move Order Script

This stored procedure allocates transactions for a move order line. It takes the line ID as input, retrieves additional details for that line, initializes the applications context, calls an API to create the move order header and transaction, and commits or handles exceptions. It returns status and messages.

Uploaded by

Olabooye Ayodeji
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
328 views3 pages

Allocate Move Order Script

This stored procedure allocates transactions for a move order line. It takes the line ID as input, retrieves additional details for that line, initializes the applications context, calls an API to create the move order header and transaction, and commits or handles exceptions. It returns status and messages.

Uploaded by

Olabooye Ayodeji
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

CREATE or replace procedure apps.allocate_transact_mo(x_line_id in number) is l_api_version NUMBER := 1.0; l_init_msg_list VARCHAR2(2) := FND_API.G_TRUE; l_return_values VARCHAR2(2) := FND_API.

G_FALSE; l_commit VARCHAR2(2) := FND_API.G_TRUE; l_return_status VARCHAR2(2); l_msg_count NUMBER := 0; l_msg_data VARCHAR2(255); l_revision VARCHAR2(255); l_locator_id NUMBER; l_transfer_to_location NUMBER; l_lot_number VARCHAR2(80); l_expiration_date DATE; l_transaction_temp_id NUMBER; l_number_of_rows NUMBER; l_detailed_qty NUMBER; x_return_status VARCHAR2(2); x_msg_count NUMBER := 0; x_msg_data VARCHAR2(255); -- API specific declarations l_move_order_type NUMBER := 1; l_transaction_mode NUMBER := 1; l_trolin_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; -- WHO columns l_user_id NUMBER := -1; l_resp_id NUMBER := -1; l_application_id NUMBER := -1; l_row_cnt NUMBER := 1; l_user_name VARCHAR2(30) := 'KEHINDE ADEYEMI'; l_resp_name VARCHAR2(30) := 'INVENTORY'; cursor c1 is select move_order_type from mtl_txn_request_headers where header_id = ( select header_id from mtl_txn_request_lines where line_id = x_line_id); BEGIN for i in c1 loop INV_REPLENISH_DETAIL_PUB.line_details_pub( p_line_id => x_line_id , x_number_of_rows => l_number_of_rows , x_detailed_qty => l_detailed_qty , x_return_status => l_return_status , x_msg_count => l_msg_count , x_msg_data => l_msg_data , x_revision => l_revision , x_locator_id => l_locator_id , x_transfer_to_location => l_transfer_to_location , x_lot_number => l_lot_number , x_expiration_date => l_expiration_date , x_transaction_temp_id => l_transaction_temp_id , p_transaction_header_id => NULL

, p_transaction_mode , p_move_order_type , p_serial_flag , p_plan_tasks , p_auto_pick_confirm , p_commit ); end loop; ;

=> => => => => =>

NULL i.move_order_type fnd_api.g_true FALSE FALSE TRUE

dbms_output.put_line(l_number_of_rows||' processed but with '||l_return_status) IF l_number_of_rows>0 THEN l_trolin_tbl:=INV_TROLIN_UTIL.Query_Rows(p_line_id => x_line_id); BEGIN -- Get the user_id SELECT user_id INTO l_user_id FROM fnd_user WHERE user_name = l_user_name; -- Get the application_id and responsibility_id SELECT application_id, responsibility_id INTO l_application_id, l_resp_id FROM fnd_responsibility WHERE responsibility_key = l_resp_name; FND_GLOBAL.APPS_INITIALIZE(l_user_id, l_resp_id, l_application_id); -- Mf g / Mfg & Dist Mgr / INV dbms_output.put_line('Initialized applications context: '|| l_user_id || ' '|| l_resp_id ||' '|| l_application_id ); l_trolin_tbl(1).line_id := x_line_id; -- call API to create move order header DBMS_OUTPUT.PUT_LINE('=================================================== ===='); DBMS_OUTPUT.PUT_LINE('Calling INV_Pick_Wave_Pick_Confirm_PUB.Pick_Confirm API'); 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_trolin_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 ); DBMS_OUTPUT.PUT_LINE('=================================================== ====');

DBMS_OUTPUT.PUT_LINE('Return Status: '||x_return_status); IF x_return_status='S' THEN fnd_file.put_line (fnd_file.LOG, '---------------'); fnd_file.put_line (fnd_file.LOG, 'Move Order Successfully Allocated and T ransacted'); END IF; IF (x_return_status <> FND_API.G_RET_STS_SUCCESS) THEN DBMS_OUTPUT.PUT_LINE('Error Message :'||x_msg_data); fnd_file.put_line (fnd_file.LOG, '---------------'); fnd_file.put_line (fnd_file.LOG, 'Move Order Errored out while transactin g '||x_msg_data); END IF; DBMS_OUTPUT.PUT_LINE('==================================================== ==='); EXCEPTION WHEN OTHERS THEN DBMS_OUTPUT.PUT_LINE('Exception Occured :'); DBMS_OUTPUT.PUT_LINE(SQLCODE ||':'||SQLERRM); DBMS_OUTPUT.PUT_LINE('================================================ ======='); fnd_file.put_line (fnd_file.LOG, '---------------'); fnd_file.put_line (fnd_file.LOG, SQLCODE ||':'||SQLERRM); END; end if; END; create or replace procedure apps.mass_move_transactions (p_move_order_no in var char2) is cursor c1 is select line_id from mtl_txn_request_headers a,mtl_txn_request_lines b where a.header_id=b.header_id and request_number=p_move_order_no; begin for i in c1 loop -apps.allocate_transact_mo(i.line_id); end loop; commit; end;

You might also like