Introduction:

This Post illustrates the steps required to Process the Account alias issue Using API.

Script

DECLARE
l_transaction_interface_id NUMBER;
l_trx_type_id NUMBER;
l_lot_control_code VARCHAR2 (500);
l_serial_number_control_code VARCHAR2 (500);
l_return_status VARCHAR2 (10);
l_errorcode NUMBER;
l_msg_count NUMBER;
l_msg_data VARCHAR2 (2000);
l_trans_count NUMBER;
lc_result NUMBER;
BEGIN
BEGIN
— Get the Interface Transaction ID
SELECT mtl_material_transactions_s.NEXTVAL
INTO l_transaction_interface_id
FROM DUAL;

— Get the Transaction type ID
SELECT transaction_type_id
INTO l_trx_type_id
FROM mtl_transaction_types
WHERE transaction_type_name = ‘Account alias issue’;

— Check if item is Lot Controlled / Serial Number Controlled
/* SELECT lot_control_code, serial_number_control_code
INTO l_lot_control_code, l_serial_number_control_code
FROM mtl_system_items_b
WHERE inventory_item_id = :l_inventory_item_id
AND organization_id = :l_organization_id;*/

INSERT INTO mtl_transactions_interface
(transaction_header_id,
transaction_interface_id,
transaction_type_id,
transaction_uom, transaction_date,
organization_id, transaction_quantity, last_update_date,
last_updated_by, creation_date,
created_by,
transaction_mode,
process_flag,
source_header_id,
source_line_id,
source_code, transaction_source_id
–,transaction_source_name
,
lock_flag, flow_schedule, scheduled_flag,
inventory_item_id, subinventory_code,
distribution_account_id
–,transaction_cost
, cost_type_id, locator_id
)
VALUES (l_transaction_interface_id — transaction_header_id
,
l_transaction_interface_id — transaction_interface_id
,
l_trx_type_id — transaction_type_id
,
‘EA’ — transaction_uom
, SYSDATE — transaction_date
,
225 — organization_id
, -4
/* — transaction_quantity // Please Note this has to be -ve as you are reducing qty from stock */
, SYSDATE — last_update_date
,
-1 — last_updated_by =
, SYSDATE — creation_date
,
-1 — created_by
,
3 — transaction_mode = BACKGROUND PROCESSING
,
1 — process_flag
,
l_transaction_interface_id — source_header_id
,
l_transaction_interface_id — source_line_id
,
‘SCRAP’ — source_code
, 60 — transaction_source_id
,
2 — Lock_flag
, ‘Y’ — flow_schedule
, 2 — scheduled_flag
,
-1 — inventory_item_id
, ‘FG’ — subinventory_code
,
1
/*– cost_type_id // For Standard Costs. Check cst_cost_types */
, 929, NULL
— locator_id // Get the inventory_location_id from mtl_item_locations_kfv
);
END;

BEGIN
lc_result :=
inv_txn_manager_pub.process_transactions
(p_api_version => 1.0,
x_return_status => l_return_status,
x_msg_count => l_msg_count,
x_msg_data => l_msg_data,
x_trans_count => l_trans_count,
p_table => 1,
p_header_id => l_transaction_interface_id
);

IF l_return_status = ‘E’
THEN
DBMS_OUTPUT.put_line (l_return_status || ” || l_msg_data);
ELSE
DBMS_OUTPUT.put_line (l_return_status || ” || l_msg_data);
END IF;
END;
END;

Got any queries?

Do drop a note by writing us at venkatesh.b@doyensys.com or use the comment section below to ask your questions

Recent Posts

Start typing and press Enter to search