1.Using script to submit INV Manager to process MMTT
/*
* When prompted for user_id, resp_id and resp_appl_id, ask ct enter the correct values for
* these variables. The values can be obtained by logging into Inventory
* reponsibility and from menu Help->Diagnostics->Examine, select block as
* $PROFILES and field as the 3 variables and note down the values of each.
*/
SET SEVEROUTPUT ON
declare
l_header_id number;
p_userid NUMBER := &user_id;
p_respid NUMBER := &resp_id;
p_applid NUMBER := &resp_appl_id;
retmsg varchar2(240);
retval number;
prnmsg varchar2(256);
begin
select mtl_material_transactions_s.nextval
into l_header_id from dual;
update mtl_material_transactions_temp
set process_flag = 'Y', lock_flag = NULL, transaction_mode = 3,
error_code = NULL, error_explanation = NULL,
transaction_header_id = l_header_id
where nvl(transaction_status, -999) <> 2
and transaction_action_id = 8 and physical_adjustment_id is not null
and transaction_source_id in (3694,3674);
fnd_global.apps_initialize(p_userid, p_respid, p_applid);
--Call Online TM
retval := INV_LPN_TRX_PUB.PROCESS_LPN_TRX(p_trx_hdr_id => l_header_id,
x_proc_msg => retmsg,
p_proc_mode => 1);
if (length(retmsg) > 200) then
prnmsg := substr(retmsg, 1, 200);
else
prnmsg := retmsg;
end if;
if (retval = 0) then
dbms_output.put_line(' All OK . msg:'||prnmsg);
commit; --TM success so commit.
else
dbms_output.put_line(' Error . msg:'||prnmsg);
rollback; --TM failed so rollback insert and update.
end if;
end;
/
2.Using script to submit INV Manager to process MTI
DECLARE
l_ret_val NUMBER ;
l_return_status VARCHAR2(1);
l_msg_data VARCHAR2(2000);
l_trans_count NUMBER ;
l_msg_count NUMBER ;
l_error_code VARCHAR2(100);
l_error_explanation VARCHAR2(2000);
BEGIN
fnd_profile.put('INV_DEBUG_TRACE', '1');
fnd_profile.put('INV_DEBUG_FILE', '/sqlcom/log/mz121dv3/utl/tm28.log');
fnd_profile.put('INV_DEBUG_LEVEL', 11);
fnd_profile.put('USER_ID', '1068');
-- fnd_profile.put('SECURITY_GROUP_ID', '0');
dbms_output.put_line('Calling TM');
l_ret_val := INV_TXN_MANAGER_PUB.process_Transactions(
p_api_version => 1.0
, p_init_msg_list => fnd_api.g_false
, p_commit => fnd_api.g_false
, p_validation_level => fnd_api.g_valid_level_full
, 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 => 22183447 );
dbms_output.put_line('process_lot_txns: fn ret : ' || l_ret_val);
dbms_output.put_line('process_lot_txns: ret value from TM: ' || l_return_status);
dbms_output.put_line('process_lot_txns: processed count: ' || l_trans_count);
IF l_return_status <> 'S' THEN
BEGIN
SELECT error_code
, error_explanation
INTO l_error_code
, l_error_explanation
FROM mtl_transactions_interface
WHERE transaction_header_id = 22183219
AND ROWNUM = 1;
dbms_output.put_line('err code: ' || l_error_code);
dbms_output.put_line('err expl: ' || l_error_explanation);
EXCEPTION
WHEN OTHERS THEN
NULL;
END;
END IF; --END IF ret sts <> 'S'
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line('process_lot_txns: Exception raised');
ROLLBACK;
END ;
转载请注明出处:
http://blog.youkuaiyun.com/pan_tian/article/details/7711155
======EOF======