ITPub博客

首页 > 数据库 > Oracle > Using script to submit INV Manager to process MTI/MMTT

Using script to submit INV Manager to process MTI/MMTT

原创 Oracle 作者:pan_tian 时间:2014-07-02 12:30:10 0 删除 编辑

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.csdn.net/pan_tian/article/details/7711155
======EOF======





<!-- Baidu Button BEGIN -->

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/26687597/viewspace-1203827/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: Script to check Txn Type, Txn Source Type, Txn Action
下一篇: 如何定义一个简单的Concurrent Program
请登录后发表评论 登录
全部评论
暂无介绍

注册时间:2012-02-18

最新文章