首页 > 代码库 > MD_STOCK_REQUIREMENTS_LIST_API 取MD04的MRP Element

MD_STOCK_REQUIREMENTS_LIST_API 取MD04的MRP Element

【转http://lz357502668.blog.163.com/blog/static/16496743201231941718527/】
?
MD_STOCK_REQUIREMENTS_LIST_API 取MD04的MRP Element  

      MD_STOCK_REQUIREMENTS_LIST_API 取MD04的MRP Elemen

 CALL FUNCTION ‘MD_STOCK_REQUIREMENTS_LIST_API‘
        EXPORTING
          matnr                    = w_marc-matnr
          werks                    = p_werks
        TABLES
          mdpsx                    = tab_mrp
          mdezx                    = tab_mrp1
          mdsux                    = tab_mrp2
        EXCEPTIONS
          material_plant_not_found = 1
          plant_not_found          = 2
          OTHERS                   = 3.
该FUNCTION 主要输入 需要查询的物料号 及工厂

      MD_PEGGING_NODIALOG  溯源需求

CALL FUNCTION ‘MD_STOCK_REQUIREMENTS_LIST_API‘
        EXPORTING
          matnr                    = w_marc-matnr
          werks                    = p_werks
        TABLES
          mdpsx                    = tab_mrp
          mdezx                    = tab_mrp1
          mdsux                    = tab_mrp2
        EXCEPTIONS
          material_plant_not_found = 1
          plant_not_found          = 2
          OTHERS                   = 3.

      LOOP AT tab_mrp into mrp_line   WHERE   ( delkz = ‘FE‘ OR delkz = ‘BE‘ ) AND umdat <> ‘00000000‘.
        IF mrp_line-delkz = ‘FE‘.              “如果生产订单 则DEL12存有生产订单号
          tab_out-del12 = mrp_line-del12.
        ELSE.                                          ”如果是采购订单 则delnr 存有PO号码
          tab_out-del12 = mrp_line-delnr.
        ENDIF.
        tab_out-baart = mrp_line-baart.
        tab_out-matnr = w_marc-matnr.
        tab_out-maktx = w_marc-maktx.
        tab_out-mng01 = mrp_line-mng01.
        tab_out-umdat = mrp_line-umdat.
        CALL FUNCTION ‘MD_PEGGING_NODIALOG‘
             EXPORTING
               edelet                      = mrp_line-delet    "排程号码规则
               edelkz                      = mrp_line-delkz   " MRP元素              

         edelnr                      = tab_out-del12    “mrp元素号码 PO号 SO号码 PR号码等
               edelps                      = mrp_line-delps   ”项目号
               eplscn                      = 000
               ematnr                      = w_marc-matnr  "物料号
               ewerks                      = p_werks            "工厂

             TABLES
*             EMDPSX                      =
               imdrqx                      = t_mdrq
            EXCEPTIONS
              error                       = 1
              no_requirements_found       = 2
              order_not_found             = 3
              OTHERS                      = 4 .
具体的DELKZ 是什么MRP元素,则考虑取哪个字段(del12或者 delnr)做为MD_PEGGING_NODIALOG的 edelkz的输入字段.

 

MD_STOCK_REQUIREMENTS_LIST_API 取MD04的MRP Element