1- Create a custom table to hold adjustment entries of issues and receipts.
CREATE TABLE XX_STOCK
( sl_no number,
organization_name varchar2(30),
organization_id number,
item varchar2(20),
item_id number,
uom varchar2(3),
subinventory varchar2(10),
quantity number,
lot varchar2(30),
txn_date date,
ucost number,
tran_type varchar2(20),
tran_type_id number(5),
locator_name varchar2(20),
locator_id number(5),
distribution_code number
);
2- Get excel data from users by giving the attached format.
3- Make a control file for sqlloader to load data into custom table XX_STOCK.
options ( skip=1 )
load data
infile 'Book1.csv'
into table APPS.XX_STOCK
fields terminated by ","
optionally enclosed by '"'
(sl_no ,
tran_type ,
organization_name,
organization_id ,
item ,
uom ,
subinventory ,
locator_name ,
quantity ,
ucost )
4- Update the remaining columns of data by sql.
UPDATE XX_STOCK SET LOCATOR_ID= (SELECT INVENTORY_LOCATION_ID FROM MTL_ITEM_LOCATIONS
WHERE ORGANIZATION_ID= XX_STOCK.ORGANIZATION_ID AND SEGMENT1= LOCATOR_NAME AND SUBINVENTORY_CODE= XX_STOCK.SUBINVENTORY);
UPDATE XX_STOCK SET ITEM_ID=
(SELECT INVENTORY_ITEM_ID FROM MTL_SYSTEM_ITEMS_B
WHERE SEGMENT1=XX_STOCK.ITEM AND ORGANIZATION_ID
= XX_STOCK.ORGANIZATION_ID);
UPDATE XX_STOCK SET distribution_code=3008;
COMMIT;
** For receipts the transaction type id is 42 and action id is 27 and the quantity is in + positive
** For issues the transaction type id is 32 and action id is 1 and the quantity is in - negative.
5- Run the command to load the custom table data into mtl_transactions_interface.
INSERT INTO MTL_TRANSACTIONS_INTERFACE
( process_flag ,
validation_required ,
transaction_mode ,
lock_flag ,
last_update_date ,
last_updated_by ,
creation_date ,
created_by ,
inventory_item_id ,
organization_id ,
transaction_quantity ,
primary_quantity ,
transaction_uom ,
transaction_date ,
subinventory_code ,
transaction_action_id ,
transaction_type_id ,
transaction_interface_id ,
source_code ,
source_line_id ,
source_header_id ,
distribution_account_id ,
transaction_cost,
locator_id )
select
1 ,
1 ,
3 ,
2 ,
'13-JUL-2015' ,
1873,
'13-JUL-2015' ,
1873,
item_id ,
organization_id ,
quantity ,
quantity ,
UOM ,
'13-JUL-2015' ,
subinventory ,
tran_action_id ,
tran_type_id ,
sl_no ,
'Testing_Data' ,
sl_no ,
-1 ,
distribution_code ,
ucost,
LOCATOR_ID
FROM XX_STOCK;
6- Run the transaction interface manager to process the data.
This comment has been removed by the author.
ReplyDelete