Using script to submit INV Manager to process MTI/MMTT

1.Using script to submit INV Manager to process MMTT

  1. /*  
  2. When prompted for user_id, resp_id and resp_appl_id, ask ct enter the correct values for   
  3. * these variables. The values can be obtained by logging into Inventory   
  4. * reponsibility and from menu Help->Diagnostics->Examine, select block as   
  5. * $PROFILES and field as the 3 variables and note down the values of each.   
  6. */  
  7. SET SEVEROUTPUT ON  
  8. declare  
  9.  l_header_id number;  
  10.  p_userid  NUMBER := &user_id;  
  11.  p_respid NUMBER  := &resp_id;  
  12.  p_applid NUMBER  := &resp_appl_id;  
  13.  retmsg varchar2(240);  
  14.  retval number;  
  15.  prnmsg varchar2(256);  
  16.    
  17.    
  18.  begin  
  19.   
  20.     select mtl_material_transactions_s.nextval   
  21.     into l_header_id from dual;  
  22.   
  23.     update mtl_material_transactions_temp  
  24.     set process_flag = 'Y', lock_flag = NULL, transaction_mode = 3,  
  25.         error_code = NULL, error_explanation = NULL,  
  26.         transaction_header_id = l_header_id  
  27.     where nvl(transaction_status, -999) <> 2  
  28.       and transaction_action_id = 8 and physical_adjustment_id is not null  
  29.       and transaction_source_id in (3694,3674);  
  30.   
  31.     fnd_global.apps_initialize(p_userid, p_respid, p_applid);  
  32.   
  33.    --Call Online TM   
  34.     retval := INV_LPN_TRX_PUB.PROCESS_LPN_TRX(p_trx_hdr_id   => l_header_id,  
  35.                                               x_proc_msg     => retmsg,  
  36.                                               p_proc_mode    => 1);  
  37.   
  38.     if (length(retmsg) > 200) then  
  39.            prnmsg := substr(retmsg, 1, 200);  
  40.     else  
  41.            prnmsg := retmsg;  
  42.     end if;  
  43.   
  44.     if (retval = 0) then  
  45.         dbms_output.put_line(' All OK . msg:'||prnmsg);  
  46.         commit--TM success so commit.   
  47.     else  
  48.         dbms_output.put_line(' Error  . msg:'||prnmsg);  
  49.         rollback;  --TM failed so rollback insert and update.   
  50.     end if;  
  51.   
  52.  end;  
  53. /  
2.Using script to submit INV Manager to process MTI
  1. DECLARE  
  2. l_ret_val NUMBER  ;  
  3. l_return_status VARCHAR2(1);  
  4. l_msg_data  VARCHAR2(2000);  
  5. l_trans_count NUMBER ;  
  6. l_msg_count NUMBER ;  
  7. l_error_code VARCHAR2(100);  
  8. l_error_explanation VARCHAR2(2000);  
  9.   
  10. BEGIN  
  11.       fnd_profile.put('INV_DEBUG_TRACE''1');  
  12.       fnd_profile.put('INV_DEBUG_FILE''/sqlcom/log/mz121dv3/utl/tm28.log');  
  13.       fnd_profile.put('INV_DEBUG_LEVEL', 11);  
  14.       fnd_profile.put('USER_ID''1068');  
  15.       --  fnd_profile.put('SECURITY_GROUP_ID', '0');   
  16.       dbms_output.put_line('Calling TM');  
  17.   
  18.       l_ret_val := INV_TXN_MANAGER_PUB.process_Transactions(  
  19.           p_api_version         => 1.0  
  20.         , p_init_msg_list       => fnd_api.g_false  
  21.         , p_commit              => fnd_api.g_false  
  22.         , p_validation_level    => fnd_api.g_valid_level_full  
  23.         , x_return_status       => l_return_status  
  24.         , x_msg_count           => l_msg_count  
  25.         , x_msg_data            => l_msg_data  
  26.         , x_trans_count         => l_trans_count  
  27.         , p_table               => 1  
  28.         , p_header_id           => 22183447 );  
  29.   
  30.       dbms_output.put_line('process_lot_txns: fn ret : ' || l_ret_val);  
  31.       dbms_output.put_line('process_lot_txns: ret value from TM: ' || l_return_status);  
  32.       dbms_output.put_line('process_lot_txns: processed count: ' || l_trans_count);  
  33.   
  34.       IF l_return_status <> 'S' THEN  
  35.         BEGIN  
  36.           SELECT error_code  
  37.                 , error_explanation  
  38.             INTO l_error_code  
  39.                 , l_error_explanation  
  40.             FROM mtl_transactions_interface  
  41.             WHERE transaction_header_id = 22183219  
  42.             AND   ROWNUM = 1;  
  43.           dbms_output.put_line('err code: ' || l_error_code);  
  44.           dbms_output.put_line('err expl: ' || l_error_explanation);  
  45.   
  46.         EXCEPTION  
  47.           WHEN OTHERS THEN  
  48.             NULL;  
  49.         END;  
  50.       END IF;    --END IF ret sts <> 'S'   
  51.    EXCEPTION  
  52.     WHEN OTHERS THEN  
  53.            dbms_output.put_line('process_lot_txns: Exception raised');  
  54.    ROLLBACK;  
  55.   
  56. END ; 
请使用浏览器的分享功能分享到微信等