DECLARE
vMTI mtl_transactions_interface%ROWTYPE;
vApiVersioin NUMBER := 1.0;
vInitMsgList VARCHAR2(2) := FND_API.G_TRUE;
VCommit VARCHAR2(2) := FND_API.G_FALSE;
xReturnStatus VARCHAR2(2);
xMsgCount NUMBER := 0;
xMsgData VARCHAR2(255);
xTransCount NUMBER;
vResult NUMBER;
vHeaderId NUMBER := -100;
BEGIN
fnd_global.apps_initialize(00, 00, 00);
--1 transaction
vMTI.Transaction_Interface_Id := mtl_material_transactions_s.NEXTVAL;
vMTI.Transaction_Header_Id := vHeaderId;
vMTI.source_code := 'Subinventory Transfer1';
vMTI.source_line_id := 0;
vMTI.source_header_id := 0;
vMTI.process_flag := 1;
vMTI.transaction_mode := 3;
vMTI.Last_Update_Date := SYSDATE;
vMTI.Last_Updated_By := fnd_global.user_id;
vMTI.Created_By := fnd_global.user_id;
vMTI.Creation_Date := SYSDATE;
vMTI.Organization_Id := 00;
vMTI.Inventory_Item_Id := 12345;
vMTI.Transaction_Quantity := 2;
vMTI.Transaction_Uom := 'PCS';
vMTI.Transaction_Date := SYSDATE;
vMTI.Transaction_Type_Id := 2;
vMTI.Subinventory_Code := 'XX01';
vMTI.Locator_Id := 001;
vMTI.Transfer_Subinventory := 'XX02';
vMTI.Transfer_Locator := 002;
vMTI.Lock_Flag := 2;
INSERT INTO mtl_transactions_interface
VALUES vMTI;
--2 transaction
vMTI.Transaction_Interface_Id := mtl_material_transactions_s.NEXTVAL;
vMTI.source_code := 'Subinventory Transfer2';
vMTI.Transaction_Quantity := 3;
INSERT INTO mtl_transactions_interface
VALUES vMTI;
VResult := inv_txn_manager_pub.process_Transactions(p_api_version => vApiVersioin,
p_init_msg_list => vInitMsgList,
p_commit => vCommit,
p_validation_level => fnd_api.g_valid_level_full,
x_return_status => xReturnStatus,
x_msg_count => xMsgCount,
x_msg_data => xMsgData,
x_trans_count => xTransCount,
p_table => 1,
p_header_id => vHeaderId);
IF (xReturnStatus <> FND_API.G_RET_STS_SUCCESS) THEN
dbms_output.put_line(xTransCount);
dbms_output.put_line('Error Message :' || xMsgData);
END IF;
IF (xReturnStatus = FND_API.G_RET_STS_SUCCESS) THEN
dbms_output.put_line('Transaction Processed Successfully');
END IF;
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line('Exception Occured :');
dbms_output.put_line(SQLCODE || ':' || SQLERRM);
END;
沒有留言:
張貼留言