Oracle EBS OPM 生产批创建事务处理

--生产批创建事物处理
--created by jenrry
DECLARE
   p_mmti_rec           mtl_transactions_interface%ROWTYPE;
   p_mmli_tbl           gme_common_pvt.mtl_trans_lots_inter_tbl;
   x_return_status      VARCHAR2 (2000);
   p_validation_level   NUMBER;
   p_init_msg_list      VARCHAR2 (2000);
   p_commit             VARCHAR2 (2000);
   x_message_count      NUMBER;
   x_message_list       VARCHAR2 (2000);
   l_msg_count          NUMBER;
   l_msg_data           VARCHAR2 (2000);
   x_mmt_rec            mtl_material_transactions%ROWTYPE;
   x_mmln_tbl           gme_common_pvt.mtl_trans_lots_num_tbl;
   l_txn_count          NUMBER;
   l_count_t            NUMBER;
   l_count_i            NUMBER;
   setup_failure        EXCEPTION;
   p_org_code           VARCHAR2 (3)                            := ‘PR1‘;
   g_debug              VARCHAR2 (5)     := fnd_profile.VALUE (‘AFLOG_LEVEL‘);

   l_user_name          VARCHAR2 (80);
   l_user_id            NUMBER;

   CURSOR get_user_id (v_user_name IN VARCHAR2)
   IS
      SELECT user_id
        FROM fnd_user
       WHERE user_name = v_user_name;

   PROCEDURE display_messages (p_msg_count IN NUMBER)
   IS
      MESSAGE               VARCHAR2 (2000);
      dummy                 NUMBER;
      l_api_name   CONSTANT VARCHAR2 (30)   := ‘DISPLAY_MESSAGES‘;
   BEGIN
      FOR i IN 1 .. p_msg_count
      LOOP
         fnd_msg_pub.get (p_msg_index          => i,
                          p_data               => MESSAGE,
                          p_encoded            => ‘F‘,
                          p_msg_index_out      => dummy
                         );
         DBMS_OUTPUT.put_line (‘Message ‘ || TO_CHAR (i) || ‘ ‘ || MESSAGE);
      END LOOP;
   EXCEPTION
      WHEN OTHERS
      THEN
         fnd_msg_pub.add_exc_msg (‘wrapper for Create_Material_txn‘, l_api_name);
   END display_messages;
BEGIN

   DBMS_OUTPUT.ENABLE (20000);

   l_user_name := ‘SYSADMIN‘;

   OPEN get_user_id (l_user_name);

   FETCH get_user_id
    INTO l_user_id;

   IF get_user_id%NOTFOUND
   THEN
      DBMS_OUTPUT.put_line (‘Invalid User ‘ || l_user_name);

      CLOSE get_user_id;

      RAISE NO_DATA_FOUND;
   END IF;

   CLOSE get_user_id;

   fnd_profile.initialize (l_user_id);

   fnd_global.apps_initialize (user_id           => l_user_id,
                               resp_id           => NULL,
                               resp_appl_id      => NULL
                              );

   x_return_status := fnd_api.g_ret_sts_success;

   fnd_msg_pub.initialize;
   gme_common_pvt.g_error_count := 0;
   gme_common_pvt.set_timestamp;
   gme_common_pvt.g_move_to_temp := fnd_api.g_false;
   p_mmti_rec.organization_id := 1199;
   p_mmti_rec.source_code := ‘OPM‘;
   p_mmti_rec.source_header_id := 147;
   p_mmti_rec.transaction_source_id := 414962;
   p_mmti_rec.trx_source_line_id := 576266;
--p_mmti_rec.last_updated_by              :=  gme_common_pvt.g_user_ident;
--p_mmti_rec.last_update_login            :=  gme_common_pvt.g_user_ident ;
--p_mmti_rec.last_update_date             :=  gme_common_pvt.g_timestamp ;
--p_mmti_rec.creation_date                :=  gme_common_pvt.g_timestamp ;
--p_mmti_rec.created_by                   :=  gme_common_pvt.g_user_ident;
   p_mmti_rec.inventory_item_id := 234657;
   p_mmti_rec.revision := NULL;
   p_mmti_rec.organization_id := 1199;
   p_mmti_rec.transaction_date := SYSDATE;
   p_mmti_rec.transaction_type_id := 44/*gme_common_pvt.g_ing_issue*/;
   p_mmti_rec.transaction_action_id := gme_common_pvt.g_ing_issue_txn_action;
   p_mmti_rec.transaction_quantity := 20;
--p_mmti_rec.primary_quantity           :=
   p_mmti_rec.transaction_uom := ‘袋‘;
   p_mmti_rec.subinventory_code := ‘CWK‘;
   p_mmti_rec.locator_id := 983;
   p_mmti_rec.transaction_source_type_id := 5;
--p_mmti_rec.transaction_source_name    :=
   p_mmti_rec.wip_entity_type := 10;
--p_mmti_rec.reason_id                  :=

    p_mmli_tbl(1).last_update_date       := gme_common_pvt.g_timestamp       ;
    p_mmli_tbl(1).last_updated_by        := gme_common_pvt.g_user_ident      ;
    p_mmli_tbl(1).creation_date          := gme_common_pvt.g_timestamp        ;
    p_mmli_tbl(1).created_by             := gme_common_pvt.g_user_ident       ;
    p_mmli_tbl(1).lot_number             := ‘L20170814‘             ;
    --p_mmli_tbl(1).parent_lot_number             := ‘GRNEWPARENTAPI‘             ;
    p_mmli_tbl(1).transaction_quantity   := 20   ; 

   gme_api_pub.create_material_txn
                           (p_api_version              => 2.0,
                            p_validation_level         => gme_common_pvt.g_max_errors,
                            p_init_msg_list            => fnd_api.g_false,
                            p_commit                   => fnd_api.g_true,
                            x_message_count            => x_message_count,
                            x_message_list             => x_message_list,
                            x_return_status            => x_return_status,
                            p_org_code                 => ‘F06‘,
                            p_mmti_rec                 => p_mmti_rec,
                            p_mmli_tbl                 => p_mmli_tbl,
                            p_batch_no                 => NULL,
                            p_line_no                  => NULL,
                            p_line_type                => NULL,
                            p_create_lot               => fnd_api.g_true,
                            p_generate_lot             => NULL,
                            p_generate_parent_lot      => NULL,
                            x_mmt_rec                  => x_mmt_rec,
                            x_mmln_tbl                 => x_mmln_tbl
                           );
   DBMS_OUTPUT.put_line (   ‘msg_count from process trxns=‘
                         || TO_CHAR (l_msg_count)
                        );

   IF l_msg_count > 1
   THEN
      display_messages (l_msg_count);
   END IF;

   DBMS_OUTPUT.put_line (   ‘after process transactions x_return_status=‘
                         || TO_CHAR (x_return_status)
                        );
-- Output the results
   DBMS_OUTPUT.put_line (SUBSTR (   ‘x_mmt_rec.transaction_id = ‘
                                 || TO_CHAR (x_mmt_rec.transaction_id),
                                 1,
                                 255
                                )
                        );
   DBMS_OUTPUT.put_line (SUBSTR (   ‘x_mmt_rec.transaction_type_id = ‘
                                 || TO_CHAR (x_mmt_rec.transaction_type_id),
                                 1,
                                 255
                                )
                        );
   DBMS_OUTPUT.put_line (SUBSTR (   ‘x_mmt_rec.transaction_action_id = ‘
                                 || TO_CHAR (x_mmt_rec.transaction_action_id),
                                 1,
                                 255
                                )
                        );
   DBMS_OUTPUT.put_line (SUBSTR (   ‘x_mmt_rec.transaction_source_id = ‘
                                 || TO_CHAR (x_mmt_rec.transaction_source_id),
                                 1,
                                 255
                                )
                        );
   DBMS_OUTPUT.put_line (SUBSTR (   ‘x_mmt_rec.trx_source_line_id = ‘
                                 || TO_CHAR (x_mmt_rec.trx_source_line_id),
                                 1,
                                 255
                                )
                        );
   DBMS_OUTPUT.put_line (SUBSTR (   ‘x_mmt_rec.source_line_id = ‘
                                 || TO_CHAR (x_mmt_rec.source_line_id),
                                 1,
                                 255
                                )
                        );
   DBMS_OUTPUT.put_line (SUBSTR (   ‘x_mmt_rec.transaction_quantity = ‘
                                 || TO_CHAR (x_mmt_rec.transaction_quantity),
                                 1,
                                 255
                                )
                        );
   DBMS_OUTPUT.put_line (SUBSTR (   ‘x_mmt_rec.transaction_uom = ‘
                                 || TO_CHAR (x_mmt_rec.transaction_uom),
                                 1,
                                 255
                                )
                        );
   DBMS_OUTPUT.put_line (SUBSTR (   ‘x_mmt_rec.transaction_date = ‘
                                 || TO_CHAR (x_mmt_rec.transaction_date),
                                 1,
                                 255
                                )
                        );
   DBMS_OUTPUT.put_line (SUBSTR (   ‘x_mmln_tbl.count = ‘
                                 || TO_CHAR (x_mmln_tbl.COUNT),
                                 1,
                                 255
                                )
                        );

   IF (x_mmln_tbl.COUNT > 0)
   THEN
      FOR i IN 1 .. x_mmln_tbl.COUNT
      LOOP
         DBMS_OUTPUT.put_line (SUBSTR (   ‘x_mmln_tbl((i).lot_number = ‘
                                       || TO_CHAR (x_mmln_tbl.COUNT),
                                       1,
                                       255
                                      )
                              );
      END LOOP;
   END IF;

   DBMS_OUTPUT.put_line (SUBSTR (   ‘x_mmt_rec.LAST_UPDATE_DATE = ‘
                                 || TO_CHAR (x_mmt_rec.last_update_date),
                                 1,
                                 255
                                )
                        );
   DBMS_OUTPUT.put_line (SUBSTR (   ‘x_mmt_rec.LAST_UPDATED_BY = ‘
                                 || TO_CHAR (x_mmt_rec.last_updated_by),
                                 1,
                                 255
                                )
                        );
   DBMS_OUTPUT.put_line (SUBSTR (   ‘x_mmt_rec.CREATION_DATE = ‘
                                 || TO_CHAR (x_mmt_rec.creation_date),
                                 1,
                                 255
                                )
                        );
   DBMS_OUTPUT.put_line (SUBSTR (   ‘x_mmt_rec.CREATED_BY = ‘
                                 || TO_CHAR (x_mmt_rec.created_by),
                                 1,
                                 255
                                )
                        );
   DBMS_OUTPUT.put_line (SUBSTR (   ‘x_mmt_rec.LAST_UPDATE_LOGIN = ‘
                                 || TO_CHAR (x_mmt_rec.last_update_login),
                                 1,
                                 255
                                )
                        );
   DBMS_OUTPUT.put_line (SUBSTR (‘x_return_status = ‘ || x_return_status,
                                 1,
                                 255
                                )
                        );
   DBMS_OUTPUT.put_line (‘x_message_count = ‘ || TO_CHAR (x_message_count));
   DBMS_OUTPUT.put_line (SUBSTR (‘x_message_list = ‘ || x_message_list, 1,
                                 255)
                        );
   gme_common_pvt.count_and_get (x_count        => x_message_count,
                                 p_encoded      => fnd_api.g_false,
                                 x_data         => x_message_list
                                );

   IF x_message_count > 1
   THEN
      display_messages (x_message_count);
   END IF;
EXCEPTION
   WHEN setup_failure
   THEN
      DBMS_OUTPUT.put_line (‘ in setup failure‘);
   WHEN OTHERS
   THEN
      DBMS_OUTPUT.put_line (SUBSTR (   ‘Error ‘
                                    || TO_CHAR (SQLCODE)
                                    || ‘: ‘
                                    || SQLERRM,
                                    1,
                                    255
                                   )
                           );
      RAISE;
END;
/

  

原文地址:https://www.cnblogs.com/jenrry/p/10021108.html

时间: 2024-10-08 20:33:15

Oracle EBS OPM 生产批创建事务处理的相关文章

Oracle EBS OPM 取消生产批

--取消生产批 --created by jenrry SET serveroutput on; DECLARE p_batch_header_rec gme_batch_header%ROWTYPE; x_batch_header_rec gme_batch_header%ROWTYPE; x_return_status VARCHAR2 (2000); p_validation_level NUMBER; p_init_msg_list VARCHAR2 (2000); p_commit V

Oracle EBS OPM 发放生产批

--发放生产批 --created by jenrry DECLARE x_return_status VARCHAR2 (1); l_exception_material_tbl gme_common_pvt.exceptions_tab; l_batch_header_rec gme_batch_header%ROWTYPE; l_in_batch_header_rec gme_batch_header%ROWTYPE; l_org_code VARCHAR2 (3); l_ignore_e

Oracle EBS R12.2创建客户化模块

以下步骤描述EBS R12.2中如何注册客户化模块,参考Oracle support Creating a CustomApplication in Oracle E-Business Suite Release 12.2 (文档 ID 1577707.1) 1.下载补丁3636980,拷贝3636980\izu\admin目录下3个.txt文件到/tmp目录下进行修改 如:izuprod.txt改名为cuxhdprod.txt izuterr.txt改名为cuxhdterr.txt 2.修改n

Oracle EBS OPM release step

--release_step生产批 --created by jenrry SET serveroutput on DECLARE x_return_status VARCHAR2 (1); l_exception_material_tbl gme_common_pvt.exceptions_tab; l_batch_step_rec gme_batch_steps%ROWTYPE; l_in_batch_step_rec gme_batch_steps%ROWTYPE; l_org_code

Oracle EBS Form Builder使用Java beans创建窗体

最近有个项目,需要研究一下Oracle的E-Business Sutie(EBS),对于以前没接触此套件的我来说,简直太痛苦了.在网上找了一堆资料,试着进行Form二次开发,也遇到各类奇葩问题.目前遇到最大的一个问题是,如何在本地 Form Builder中进行窗体构建,并调用后台的JavaBean对窗体进行交互?网上也有不少的解决方案,但是都存在一些差异,试了很多次,终于实现了我预期的效果. 为了防止以后再遇到类似的问题,先做一个记录,以备后查. 1.环境搭建说明  服务器:Oracle EB

Oracle EBS 采购 接收入库 接口开发

http://blog.itpub.net/25164132/viewspace-746657/ 接收入库是项目中会经常碰到的开发,这类开发一般来说比较简单,但是接收入库在Oracle中其实涉及到很多模块,其中层次较多,也可以做得比较复杂.本文将尽可能深入细致地讨论接收入库的流程,种类,数据来源,数据的流动路径,以及各个数据点之间的对应关系.最后将给出一个较为全面的接收入库的样例代码.接收入库的种类接收入库可以按照数据来源分为2种:1.         对于po订单以及发放的接收入库:2.   

Oracle EBS 如何月结、对账[Z]

在Oracle系统处理月结业务时,需要遵循一定的操作顺序.这些业务,牵涉到相应的模块,包括:应付模块.采购模块.库存模块.应收模块.薪资模块.固定资产和总帐模块等 在Oracle系统中,总帐模块处于财务核算的核心地位,它从其他模块中接收财务信息.总帐接收到的财务信息与子模块业务必须保持一致,才能保证整个系统的帐务是正确的,所以要进行对帐. 后面将描述一下模块之间的关帐顺序及模块间关帐要完成的步骤 一.Oracle EBS 月结应付(AP)对账顺序 步骤,1.检查业务是否全部录入:2.检查是否有

Oracle EBS 如何月结[Z]

概述应付模块的多数业务基于采购和库存的操作,因此应付模块的月结应该在采购模块和库存模块月结后才能关闭会计期.月结步骤在每个会计期末,应付模块的月结应遵循以下流程:1.检查业务是否全部录入;2.检查是否有未验证.暂挂发票;3.更新到期的远期付款状态;4.检查应付业务是否生成分录;5.应付业务传送到总帐;6.确认应付分录全部传送总帐;7.创建成批增加;8.复核凭证,确认无误后过帐;9.确认及核对供应商余额;10.关闭应付会计期间;11.打开新的会计期;12.为通过手工方式进入存货成本的调整准备数据:

[转]oracle EBS 基础100问

from:http://www.cnblogs.com/xiaoL/p/3593691.html  http://f.dataguru.cn/thread-51057-1-1.html 1001 ORACLE EBS学习的其他资源有哪四个? 1002 ORACLE OPEN WORLD大会是不是一个市场营销活动? 1003 Oracle 大学有哪五种课程? 1004 多个责任分配给一个人,是多对一关系,还是一对多关系? 1005 一个责任分配给多个人,是什么样的关系? 1006 双+号和双-号,