需求朔源——MD_PEGGING_NODIALOG

MD04供需状况:

①生产订单19084582和19090790的供给都是给安库需求使用

②生产订单20019995的供给是给订单200006134项目50使用

 

①CTYB0757-P1库存量满足第一笔EQ-101046-01-DE需求使用,也就是上图的生产订单19084582 (库存87 - 需求84  = 结余3)

②生产订单20025412的供给是给第二笔EQ-101046-01-DE需求使用,也就是上图的生产订单19090790(结余3 - 需求1428 + 供给11 = 结余-1414)

③生产订单20019183的1414个供给是给第二笔EQ-101046-01-DE需求使用,也就是上图的生产订单19090790 (结余-1414 + 供给1824 =  结余410 )

④生产订单20019183的410个供给是给第三笔EQ-101046-01-DE需求使用,也就是上图的生产订单20019995(结余410 - 需求1554 = 结余 -1144)

⑤生产订单20027828的供给是给第三笔EQ-101046-01-DE需求使用,也就是上图的生产订单20019995 (结余-1144 + 供给1150 = 结余6)

 

代码:

TYPE-POOLS: slis.
DATA: gs_layout   TYPE slis_layout_alv,
      gt_fieldcat TYPE slis_t_fieldcat_alv.

DATA: lt_mdrq LIKE mdrq OCCURS 0 WITH HEADER LINE.

CALL FUNCTION 'MD_PEGGING_NODIALOG'
  EXPORTING
    edelkz                      = 'FE' "MRP元素
    edelnr                      = '000020019183' "MRP元素號碼
    edelps                     = '000001'     "MRP 元素項目
    ematnr                      = 'CTYB0757-P1' "物料编号
    ewerks                      = '2000'  "工厂
    eberid                      = '2000'   "MRP范围
  TABLES
    imdrqx                      = lt_mdrq
 EXCEPTIONS
   error                       = 1
   no_requirements_found       = 2
   order_not_found             = 3
   OTHERS                      = 4.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
      i_program_name         = sy-repid
      i_internal_tabname     = 'LT_MDRQ'
      i_inclname             = sy-repid
    CHANGING
      ct_fieldcat            = gt_fieldcat
    EXCEPTIONS
      inconsistent_interface = 1
      program_error          = 2
      OTHERS                 = 3.

gs_layout-colwidth_optimize = 'X'.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
  EXPORTING
    i_callback_program       = sy-repid
    is_layout                = gs_layout
    it_fieldcat              = gt_fieldcat[]
    i_save                   = 'A'
  TABLES
    t_outtab            =  lt_mdrq
  EXCEPTIONS
    program_error            = 1
    OTHERS                   = 2.

 

效果:

posted @ 2020-06-04 18:25  鲸与海  阅读(2826)  评论(0编辑  收藏  举报