技术开发 频道

生成转储拣配单的ABAP程序

【IT168 技术文章】

report ZE_MM_SCPSDD
       no standard page heading line-size 150.
*---------------------------生成转储拣配单的ABAP程序-------------------------------------------*
*   data definition
*----------------------------------------------------------------------*
type-pools: slis.
*       Batchinputdata of single transaction
DATA:   BDCDATA LIKE BDCDATA    OCCURS 0 WITH HEADER LINE.
*       messages of call transaction
DATA:   MESSTAB LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
*       error session opened (' ' or 'X')
DATA:   E_GROUP_OPENED.
*       message texts
TABLES: RESB , AFPO ,AFKO, MARA ,EKET ,ZSCPSDD ,EKKO ,MARC,ZDSCDD,zlog.
data: mdezx like mdez occurs 0.
data: wa_mdezx like line of  mdezx.
data: mdpsx like mdps occurs 0.
data: wa_mdpsx like line of  mdpsx.
data: mdsux like mdsu occurs 0.
DATA: begin of itab_mrp  OCCURS 0,
    RSNUM like RESB-RSNUM , "预留号#
    RSPOS like RESB-RSPOS , "预留项目
    MATNR like RESB-MATNR , "物料号码#
    MAKTX like MAKT-MAKTX , "物料描述#
    BDMNG like RESB-BDMNG , "需求量#
    BDTER like RESB-BDTER , "需求日期#
    LABST like MARD-LABST , "库存量
    MENGE like RESB-BDMNG , "采购订单数量,配送量
    WERKS like RESB-WERKS , "@@新增工厂
    LGORT like RESB-LGORT , "@@新增仓库
    AUFNR like RESB-AUFNR , "相关生产订单
    GSTRP like AFKO-GSTRP , "生产订单基本开始时间
    ARBPL like CRHD-ARBPL , "工作中心
    AUFPL like RESB-AUFPL , "计划工艺路线号
    APLZL like RESB-APLZL , "计数器
    DELB0 like mdez-DELB0 , "MRP(物料需求计划)元素
    PLNBEZ like afko-PLNBEZ , "MRP(物料需求计划)数据
 end of itab_mrp.


**调用BAPI所需要的内表
**参照ZTEST_BAPI_CREATE_PO
**************************
DATA:itab_poheader LIKE bapimepoheader OCCURS 0 WITH HEADER LINE,
itab_poheaderx LIKE bapimepoheaderx OCCURS 0 WITH HEADER LINE,
 itab_poitems LIKE bapimepoitem OCCURS 0 WITH HEADER LINE,
 itab_poitemx LIKE bapimepoitemx OCCURS 0 WITH HEADER LINE,
 exppurchaseorder LIKE bapimepoheader-po_number,
 itab_itemsche LIKE bapimeposchedule  OCCURS 0 WITH HEADER LINE,
 itab_itemschex LIKE BAPIMEPOSCHEDULX   OCCURS 0 WITH HEADER LINE,
 return LIKE bapiret2 OCCURS 0 WITH HEADER LINE.

DATA:BEGIN OF recordhead OCCURS 0,
     LIFNR_001 like  EKKO-LIFNR, "供应商帐户号:P1800
     BSART_002 like  RM06E-BSART , "订单类型(采购):ZEB
     BEDAT_003 like  RM06E-BEDAT ,"采购订单日期:sy-datum
     EKORG_004 like  EKKO-EKORG , "采购组织:2000
     EKGRP_005 like  EKKO-EKGRP ,                           "采购组:F01
     EEIND_006 like  RM06E-EEIND , "交货日期:P_EINDT
     LPEIN_007 like  RM06E-LPEIN , "交货日的类别:T
     WERKS_008 like  RM06E-WERKS , "工厂:P_WERKS
     LGORT_009 like  RM06E-LGORT,  "库存地点:P_LGORT
     END OF recordhead.

data: begin of record  OCCURS 0,
    CHKID  TYPE c,
    RSNUM like RESB-RSNUM , "预留号#
    RSPOS like RESB-RSPOS , "预留项目
    MATNR like RESB-MATNR , "物料号码#
    MAKTX like MAKT-MAKTX , "物料描述#
    BDMNG like RESB-BDMNG , "需求量#
    BDTER like RESB-BDTER , "需求日期#
    LABST like MARD-LABST , "库存量
    MENGE like RESB-BDMNG , "采购订单数量,配送量
    WERKS like RESB-WERKS , "@@新增工厂
    LGORT like RESB-LGORT , "@@新增仓库
    AUFNR like RESB-AUFNR , "相关生产订单
    GSTRP like AFKO-GSTRP , "生产订单基本开始时间
    ARBPL like CRHD-ARBPL , "工作中心
    AUFPL like RESB-AUFPL , "计划工艺路线号
    APLZL like RESB-APLZL , "计数器
*    VORNR like RESB-VORNR , "作业
*    PLNFL like RESB-PLNFL , "序列
 end of record.


DATA: recordline like LINE OF record.
*DATA : record LIKE TABLE OF ZSCPSDD001 WITH HEADER LINE.
*** End generated data section ***
DATA:selrecord like TABLE OF record WITH HEADER LINE.

DATA:instab like TABLE OF zdscdd WITH HEADER LINE.

DATA: pmode TYPE c VALUE 'E' ,
     umode TYPE c VALUE 'S'.

DATA: begin of sumrecord  OCCURS 0,
    CHKID(1)   , "选择
    MATNR like RESB-MATNR , "物料号码#
    MAKTX like MAKT-MAKTX , "物料描述#
    EEIND like RM06E-EEIND ,"交货日期
    BDMNG like RESB-BDMNG , "需求量#
    LABST like MARD-LABST , "库存量
    ZTKCL like MARD-LABST , "在途库存
    MENGE like RESB-BDMNG , "采购订单数量,配送量
    WERKS like RESB-WERKS , "@@新增工厂
    LGORT like RESB-LGORT , "@@新增仓库
    ARBPL like CRHD-ARBPL , "工作中心
    end of sumrecord .

DATA: sumrecord_wa like line of sumrecord.

DATA: begin of msgtab occurs 0,
      msg(255),
      msgtype(1),
      end of msgtab.
*DATA: msg(255),msgtype(1).

SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE t01.
SELECT-OPTIONS: P_WERKS FOR RESB-WERKS OBLIGATORY  NO intervals NO-EXTENSION."工厂
SELECT-OPTIONS: P_LGORT FOR RESB-LGORT OBLIGATORY  ."线边库 NO intervals NO-EXTENSION
SELECT-OPTIONS: P_AUFNR FOR AFPO-AUFNR  ."生产订单号
SELECT-OPTIONS: P_BDTER FOR RESB-BDTER OBLIGATORY  NO intervals NO-EXTENSION  ."需求日期
SELECT-OPTIONS: P_MATKL FOR MARA-MATKL  ."物料组
SELECT-OPTIONS: P_MATNR FOR RESB-MATNR  ."物料号
SELECT-OPTIONS: P_EINDT FOR EKET-EINDT OBLIGATORY NO intervals NO-EXTENSION DEFAULT sy-datum."交货日期
PARAMETERS:     P_PS RADIOBUTTON GROUP PSBZ.
PARAMETERS:     P_FPS RADIOBUTTON GROUP PSBZ.
SELECTION-SCREEN: END OF BLOCK b1.


SELECTION-SCREEN: BEGIN OF BLOCK b2 WITH FRAME TITLE t02.
SELECT-OPTIONS: P_WERKS2 FOR MARC-WERKS OBLIGATORY  NO intervals NO-EXTENSION."发货工厂
SELECT-OPTIONS: P_LGFSB FOR MARC-LGFSB ."发货存储地点
SELECTION-SCREEN: END OF BLOCK b2.

*SELECTION-SCREEN: BEGIN OF BLOCK b3 WITH FRAME TITLE t03.
*PARAMETERS: P_SCSL TYPE I DEFAULT '200' OBLIGATORY .
*SELECTION-SCREEN: END OF BLOCK b3.

*SELECTION-SCREEN: BEGIN OF BLOCK b2 WITH FRAME TITLE text-001.
*PARAMETERS: pmode TYPE c DEFAULT 'N' OBLIGATORY.
*PARAMETERS: umode TYPE c DEFAULT 'A' OBLIGATORY.
*SELECTION-SCREEN: END OF BLOCK b2.

DATA: i_private TYPE slis_data_caller_exit,
      i_selfield TYPE slis_selfield,
      W_exit(1) TYPE c.

INITIALIZATION.
  t01 = '收货信息'.
  t02 = '发货信息'.
*  t03 = '输出参数'.

start-of-selection.
  perform write_zlog.
  perform get_recordhead .
  perform get_record .

  LOOP AT record." 全部计数WHERE CHKID = 'X'.
    selrecord-CHKID = record-CHKID .
    selrecord-RSNUM = record-RSNUM .
    selrecord-RSPOS = record-RSPOS .
    selrecord-MATNR = record-MATNR .
    selrecord-MAKTX = record-MAKTX .
    selrecord-BDMNG = record-BDMNG .
    selrecord-BDTER = record-BDTER .
    selrecord-LABST = record-LABST .
    selrecord-MENGE = record-MENGE .
    selrecord-WERKS = record-WERKS .
    selrecord-LGORT = record-LGORT .
    selrecord-AUFPL = record-AUFPL .
    selrecord-ARBPL = record-ARBPL .
    append selrecord .
    clear selrecord .
  ENDLOOP.
*SHIFT P_EINDT BY 3 PLACES LEFT.
  LOOP AT selrecord .
    DATA ARBPL2 like CRHD-ARBPL.
    CLEAR ARBPL2.
    LOOP AT sumrecord where matnr = selrecord-matnr.
      ARBPL2 = sumrecord-ARBPL.
    ENDLOOP.
    sumrecord-MATNR = selrecord-MATNR .
    sumrecord-MAKTX = selrecord-MAKTX .
    sumrecord-EEIND = P_EINDT.
    sumrecord-BDMNG = selrecord-BDMNG .
    sumrecord-WERKS = selrecord-WERKS .
    sumrecord-LGORT = selrecord-LGORT .
    IF ARBPL2 is initial.
      sumrecord-ARBPL = selrecord-ARBPL.
    ELSE.
      sumrecord-ARBPL = ARBPL2.
    ENDIF.
    collect sumrecord .
    clear sumrecord .
  ENDLOOP.

  LOOP AT sumrecord.
    DATA: begin of itab_arbpl occurs 0 ,
    matnr like resb-matnr ,
    werks like resb-werks,
    lgort like resb-lgort,
    ARBPL like CRHD-ARBPL ,
    counts type int4,
    end of itab_arbpl.

    clear itab_arbpl.
    refresh itab_arbpl.

    LOOP AT selrecord where matnr = sumrecord-matnr and werks = sumrecord-werks and lgort = sumrecord-lgort.
      itab_arbpl-matnr = selrecord-matnr.
      itab_arbpl-werks = selrecord-werks.
      itab_arbpl-lgort = selrecord-lgort.
      itab_arbpl-arbpl = selrecord-arbpl.
      itab_arbpl-counts = 1.
      collect itab_arbpl.
      clear itab_arbpl.
    ENDLOOP.

    sort itab_arbpl BY counts DESCENDING .
       LOOP AT itab_arbpl .
          if sy-tabix = 1.
              sumrecord-arbpl = itab_arbpl-arbpl.
          endif.
       endloop.
    modify sumrecord.
  ENDLOOP.

*定义采购相关内表,获取采购数量
  DATA: BEGIN OF cgsltab occurs 0,
        MATNR LIKE EKPO-MATNR,
        WERKS LIKE EKPO-WERKS,
        LGORT LIKE EKPO-LGORT,
        MENGE LIKE EKPO-MENGE,
        EBELN LIKE EKPO-EBELN,
        EBELP LIKE EKPO-EBELP,
        BSART LIKE EKKO-BSART,
        EINDT LIKE EKET-EINDT,
        END OF cgsltab.
  DATA: cgsl type EKPO-MENGE.
  LOOP AT sumrecord .
    clear cgsltab.
    refresh cgsltab.
    "@@因为非限制库存只有一份,不能放在上面的collect中
    LOOP AT selrecord  WHERE MATNR = sumrecord-MATNR  and LGORT = sumrecord-LGORT .
      sumrecord-LABST = selrecord-LABST .
    ENDLOOP.
    sumrecord-MENGE = sumrecord-BDMNG - sumrecord-LABST .
*在这里求在途库存量
*ZEB采购-101+102+122
    SELECT EBELN
           EBELP
           MATNR
           WERKS
           LGORT
           MENGE
           INTO CORRESPONDING FIELDS OF TABLE cgsltab    "modify by hurd for index
    FROM EKPO
    WHERE MATNR = sumrecord-MATNR
          and WERKS = sumrecord-WERKS
          and LGORT = sumrecord-LGORT
          and LOEKZ <> 'L'  "已删除标志
          and ELIKZ <> 'X'. "已完成交货
    LOOP AT cgsltab.
      SELECT SINGLE BSART INTO cgsltab-BSART
      FROM EKKO
      WHERE EBELN = cgsltab-EBELN.
      "@@1.3(2)排除非ZEB的采购订单
      if cgsltab-BSART <> 'ZEB'.
        DELETE cgsltab index sy-tabix.
        continue.
      ENDIF.
      "@@1.3(3)排除日期大于需求日期的
      SELECT SINGLE EINDT INTO cgsltab-EINDT
      FROM EKET
      WHERE EBELN = cgsltab-EBELN and EBELP = cgsltab-EBELP.
      if cgsltab-EINDT > P_BDTER.
        delete cgsltab index sy-tabix.
        continue.
      ENDIF.
      modify cgsltab.
      clear cgsltab.
    ENDLOOP.

    "@@1.3(2)去除相应的收货-101+102+122
    LOOP AT cgsltab.
      DATA: 101_sl type EKPO-MENGE,
            102_sl type EKPO-MENGE,
            122_sl type EKPO-MENGE.
      101_sl = 0.
      102_sl = 0.
      122_sl = 0.
      SELECT MENGE FROM EKBE
      INTO 101_sl
      WHERE EBELN = cgsltab-EBELN
      and EBELP = cgsltab-EBELP
      and BWART = '101'.
        cgsltab-MENGE = cgsltab-MENGE - 101_sl .
      ENDSELECT.

      SELECT MENGE FROM EKBE
      INTO 102_sl
      WHERE EBELN = cgsltab-EBELN
      and EBELP = cgsltab-EBELP
      and BWART = '102'.
        cgsltab-MENGE = cgsltab-MENGE + 102_sl .
      ENDSELECT.

      SELECT MENGE FROM EKBE
      INTO 122_sl
      WHERE EBELN = cgsltab-EBELN
      and EBELP = cgsltab-EBELP
      and BWART = '122'.
        cgsltab-MENGE = cgsltab-MENGE + 122_sl .
      ENDSELECT.
      modify cgsltab.
      clear  cgsltab.
    ENDLOOP.
    "求得总采购数量
    cgsl = 0 .
    LOOP AT cgsltab.
      cgsl = cgsl + cgsltab-MENGE.
    ENDLOOP.

    "@@在途总量
    sumrecord-ZTKCL = cgsl.

    sumrecord-MENGE = sumrecord-MENGE - sumrecord-ZTKCL.
    "考虑将其圆整
    DATA: BSTRF like MARC-BSTRF.
    SELECT SINGLE BSTRF FROM MARC
    INTO BSTRF
    WHERE MATNR = sumrecord-MATNR and WERKS = P_WERKS2.
    IF BSTRF is not initial and BSTRF <> 0.
      sumrecord-MENGE = CEIL( sumrecord-MENGE / BSTRF ) * BSTRF .
    ENDIF.

    Modify sumrecord .
    clear sumrecord .
  ENDLOOP.
  LOOP AT sumrecord .
    if sumrecord-MENGE <= 0 .
      delete sumrecord index sy-tabix.
    endif.
  ENDLOOP.

  if sumrecord[] is initial .
    MESSAGE '线边库善有充足库存无需配送!' TYPE 'I'.
*     Leave to screen 0.
    STOP.
*    CALL TRANSACTION 'ZSCPSDD' USING bdcdata MODE pmode UPDATE umode
*                         MESSAGES INTO messtab.

  ELSE.
    perform displaying.
  endif. "end of sumrecord[] is initial .

TOP-OF-PAGE.

END-OF-selection .


*  SET PF-STATUS 'SCPSDD001'.

*AT USER-COMMAND.
*  PERFORM user_command.
*----------------------------------------------------------------------*
*        Start new screen                                              *
*----------------------------------------------------------------------*
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
  CLEAR BDCDATA.
  BDCDATA-PROGRAM  = PROGRAM.
  BDCDATA-DYNPRO   = DYNPRO.
  BDCDATA-DYNBEGIN = 'X'.
  APPEND BDCDATA.
ENDFORM.                    "BDC_DYNPRO

*----------------------------------------------------------------------*
*        Insert field                                                  *
*----------------------------------------------------------------------*
FORM BDC_FIELD USING FNAM FVAL.
*  IF FVAL <> NODATA.
  CLEAR BDCDATA..
  BDCDATA-FNAM = FNAM.
  BDCDATA-FVAL = FVAL.
  APPEND BDCDATA.
*  ENDIF.
ENDFORM.                    "BDC_FIELD

*perform close_group.
*perform close_dataset using dataset.
*&---------------------------------------------------------------------*
*&      Form  get_recordhead
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM get_recordhead .
  SHIFT P_EINDT  BY 3 PLACES LEFT.
  SHIFT P_WERKS  BY 3 PLACES LEFT.
*@@  SHIFT P_LGORT  BY 3 PLACES LEFT.
  SHIFT P_WERKS2 BY 3 PLACES LEFT.

*供应商需要从输入P_WERKS2到供应商表中查询
  SELECT SINGLE LIFNR
  INTO (recordhead-LIFNR_001)
  FROM LFA1
  WHERE LFA1~WERKS = P_WERKS2.
  if recordhead-LIFNR_001 is initial .
    recordhead-LIFNR_001 = 'P1800' .
  endif.
  recordhead-BSART_002 = 'ZEB'.
  recordhead-BEDAT_003 = sy-datum .
  recordhead-EKORG_004 = '2000' .
  recordhead-EKGRP_005 = 'F01' .
  recordhead-EEIND_006 = P_EINDT .
  recordhead-LPEIN_007 = 'T' .
  recordhead-WERKS_008 = P_WERKS .
  recordhead-LGORT_009 = ''."@@去掉P_LGORT .
ENDFORM.                    " get_recordhead
*&---------------------------------------------------------------------*
*&      Form  get_record
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM get_record .

  SHIFT P_BDTER BY 3 PLACES LEFT.
  DATA:SOBSL LIKE MARC-SOBSL.
  DATA: SFPS(1).

*@@(11)发货工厂的特殊采购类
  DATA: FHGC(4),TSCGL(2).
*SHIFT  P_WERKS2 BY 3 PLACES LEFT.
  FHGC = P_WERKS2.
  CONDENSE FHGC.
*-----------------modify by hurd------
  case FHGC.
  when '1910'.
  TSCGL =  '61'.
  when '1920'.
  TSCGL =  '62'.
  when '2100'.
    TSCGL =  '63'.
  when '3100'.
    TSCGL =  '65'.
  when '1800'.
    TSCGL =  '66'.
  when '1200'.
    TSCGL =  '67'.
  when '1100'.
    TSCGL =  '68'.
  when '5100'.
    TSCGL =  '81'.
  endcase.
*-------------------------------------
*  IF  FHGC = '1910'.
*    TSCGL =  '61'.
*  ENDIF.
*  IF FHGC = '1920'.
*    TSCGL =  '62'.
*  ENDIF .
*  IF  FHGC = '2100'.
*    TSCGL =  '63'.
*  ENDIF .
*  IF  FHGC = '3100'.
*    TSCGL =  '65'.
*  ENDIF .
*  IF  FHGC = '1800'.
*    TSCGL =  '66'.
*  ENDIF .
*  IF  FHGC = '1200'.
*    TSCGL =  '67'.
*  ENDIF.
*  IF  FHGC = '1100'.
*    TSCGL =  '68'.
*  ENDIF.
*  IF  FHGC = '5100'.
*    TSCGL =  '81'.
*  ENDIF.

  DATA: isappend(1),
        appendcounts type i.
  appendcounts = 0.
*  SELECT  RSNUM RSPOS MATNR BDMNG BDTER WERKS LGORT SORTF AUFNR AUFPL APLZL FROM RESB
*  INTO (record-RSNUM,record-RSPOS,record-MATNR,record-BDMNG,record-BDTER,
*        record-WERKS,record-LGORT,SFPS,record-AUFNR,record-AUFPL,record-APLZL)
  SELECT  RSNUM
          RSPOS
          MATNR
          WERKS
          LGORT
          BDMNG
          BDTER
          AUFNR
          SORTF
          AUFPL
          APLZL
          FROM RESB
  INTO (record-RSNUM,record-RSPOS,record-MATNR,record-WERKS,record-LGORT,record-BDMNG,
        record-BDTER,record-AUFNR,SFPS,record-AUFPL,record-APLZL)   "modify by hurd   for index
*UP TO  P_SCSL ROWS "这里要用计数器
  where XLOEK = '' "@@(1)删除标志
          and KZEAR = '' "@@(2)发货完成标志
          and DUMPS = '' "@@去除虚拟件
          and BDART = 'AR' "@@20061114修改预留类型:OrdRes
          and WERKS IN P_WERKS "@@(3)收货工厂
          and LGORT IN P_LGORT "@@(4) 收货线边库
          and AUFNR in P_AUFNR "@@(5) 生产订单号
          and BDTER <= P_BDTER "@@ (6) 需求日期,去生产订单找基本开始日期GSTRP
          "@@(7)物料组在下面删掉
          and MATNR in P_MATNR . "@@(8)物料号

    isappend = 'Y'.

    "@@@判断排序字段
*    SELECT SINGLE SORTF FROM RESB INTO SFPS
*      WHERE RSNUM = record-RSNUM and MATNR = record-MATNR.
    IF P_PS = 'X'.
      IF SFPS = 'N'.
        isappend = 'N'.
        continue.
      ENDIF.
    ENDIF.
    IF P_FPS = 'X'.
      IF SFPS <> 'N'.
        isappend = 'N'.
        continue.
      ENDIF.
    ENDIF.
    "@@@判断物料组
    IF P_MATKL IS NOT initial.
      DATA: MATKL LIKE MARA-MATKL.
      SELECT SINGLE MATKL FROM MARA
      INTO MATKL
      WHERE MATNR = record-MATNR.
      IF MATKL NOT IN  P_MATKL.
        isappend = 'N'.
        continue.
      ENDIF.
    ENDIF.

    "@@(9)收货工厂的特殊采购类
    "@@061027:如果特殊采购类为空,则允许本工厂到本工厂
    SELECT SINGLE SOBSL FROM MARC
    INTO SOBSL
    WHERE MATNR = record-MATNR and WERKS in P_WERKS.
    IF SOBSL <> TSCGL .
      IF SOBSL is not initial or P_WERKS <> P_WERKS2.
        isappend = 'N'.
        continue.
      ENDIF.
    ENDIF.

    DATA: FHCCDD(4).
    DATA: BESKZ like marc-beskz,
          LGFSB like marc-lgfsb,
          LGPRO like marc-LGPRO.

    "@@(11)发货工厂的特殊采购类 20070709常进强要求修改
    SELECT SINGLE BESKZ LGFSB LGPRO FROM MARC
    INTO  (BESKZ,LGFSB,LGPRO)
    WHERE MATNR = record-MATNR and WERKS = FHGC.

    if BESKZ = 'F'.
      FHCCDD = LGFSB.
    elseif BESKZ = 'E'.
      FHCCDD = LGPRO.
    endif.

    "@@(12)MARC-LGFSB IN '发货存储地点‘
    IF P_LGFSB is not initial.
      IF FHCCDD NOT IN P_LGFSB.
        isappend = 'N'.
        continue.
      ENDIF.
    ENDIF.

**在途量不在这里考虑,而是对选择的物料进行按库位汇总后,再考虑
**在这里获得工作中心。
    DATA: PLNNR like AFVC-PLNNR,
          ARBID like AFVC-ARBID,
          ARBPL like CRHD-ARBPL.
    CLEAR PLNNR. CLEAR ARBID.CLEAR ARBPL.
*    select single PLNNR from caufv
*    into PLNNR
*    where aufnr = record-aufnr.

    select single ARBID from afvc
    into ARBID
    where AUFPL = record-AUFPL and APLZL = record-APLZL.

    select single arbpl from crhd
    into ARBPL
    where OBJID = ARBID and OBJTY = 'A'.

    record-ARBPL = ARBPL.

    IF isappend = 'N'.
      continue.
    ENDIF.
    "最后的加入
    IF isappend = 'Y'.
      append record.
      appendcounts = appendcounts + 1.
    ENDIF.
    clear  record.

  ENDSELECT.

  if record[] is initial .
    MESSAGE '没有查询到数据' TYPE 'I'.
    STOP.
  endif.

  clear record.

  loop at record.

    SELECT SINGLE MAKTX FROM MAKT
      INTO record-MAKTX
      WHERE MATNR = record-MATNR .

    SELECT SINGLE LABST FROM MARD
      INTO record-LABST
      WHERE WERKS = record-WERKS and  LGORT = record-LGORT
            and MATNR = record-MATNR .

    record-MENGE = record-BDMNG - record-LABST .
    MODIFY record.
  endloop.
  SORT record BY RSNUM ASCENDING.
  IF record[] IS INITIAL.
    MESSAGE '没有查询到数据' TYPE 'I'.
*    CALL TRANSACTION 'ZSCPSDD' USING bdcdata MODE pmode UPDATE umode
*                         MESSAGES INTO messtab.
    STOP.
  ENDIF.
ENDFORM.                    " get_record
*&---------------------------------------------------------------------*
*&      Form  output
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM output .

  if sy-subrc <> 0. exit. endif.

  perform bdc_dynpro      using 'SAPMM06E' '0100'.
  perform bdc_field       using 'BDC_CURSOR'
                                'RM06E-LGORT'.
  perform bdc_field       using 'BDC_OKCODE'
                                '=AB'.
  perform bdc_field       using 'EKKO-LIFNR'
                                recordhead-LIFNR_001. "供应商帐户号:P1800
  perform bdc_field       using 'RM06E-BSART'
                                recordhead-BSART_002. "订单类型(采购):ZEB
  perform bdc_field       using 'RM06E-BEDAT'
                                recordhead-BEDAT_003. "采购订单日期:sy-datum
  perform bdc_field       using 'EKKO-EKORG'
                                recordhead-EKORG_004. "采购组织:2000
  perform bdc_field       using 'EKKO-EKGRP'
                                recordhead-EKGRP_005.       "采购组:F01
  perform bdc_field       using 'RM06E-EEIND'
                                recordhead-EEIND_006. "交货日期:P_EINDT
  perform bdc_field       using 'RM06E-LPEIN'
                                recordhead-LPEIN_007. "交货日的类别:T
  perform bdc_field       using 'RM06E-WERKS'
                                recordhead-WERKS_008. "工厂:P_WERKS
*因交货地点多个,所以需要屏蔽掉,并在后面进行改动
  perform bdc_field       using 'RM06E-LGORT'
                                recordhead-LGORT_009. "库存地点:P_LGORT,实际为空
  DATA: counts type i ,
        tabcounts type i.
  counts = 1 .
  tabcounts = 0 .
  Loop At sumrecord where chkid = 'X'.
    tabcounts = sy-tabix .
  endloop.
  DATA: countchar(4)  ,
        tabcountchar(4)  ,
        totalparam(20) type c VALUE  'EKPO-MENGE('.
  tabcountchar = tabcounts .
  condense tabcountchar.
  if tabcounts < 10 .
    CONCATENATE totalparam '0' tabcountchar ')' INTO totalparam .
  else .
    CONCATENATE totalparam  tabcountchar ')' INTO totalparam .
  endif .
  perform bdc_dynpro      using 'SAPMM06E' '0120'.
  perform bdc_field       using 'BDC_CURSOR'
                                totalparam.
  perform bdc_field       using 'BDC_OKCODE'
                                '=BU'.

  DATA: param1(20) type c VALUE 'EKPO-EMATN(',
        param2(20) type c VALUE 'EKPO-MENGE(',
        param3(30) type c VALUE 'EKPO-LGORT(',"@@增加仓库
        data(13) type c VALUE ' '.
  loop at sumrecord where chkid = 'X'.
    param1 = 'EKPO-EMATN('.
    countchar = counts.
    condense countchar.
    if counts < 10 .
      CONCATENATE param1 '0' countchar ')' INTO param1 .
    else .
      CONCATENATE param1  countchar ')' INTO param1 .
    endif .

    perform bdc_field       using param1
                                  sumrecord-MATNR. "物料号码
    counts = counts + 1 .
  ENDLOOP.

  counts = 1.
  loop at sumrecord where chkid = 'X'.
    param2 = 'EKPO-MENGE('.
    data = ' '.
    countchar = counts.
    condense countchar.
    if counts < 10 .
      CONCATENATE param2 '0' countchar ')' INTO param2 .
    else .
      CONCATENATE param2  countchar ')' INTO param2 .
    endif .
    data = sumrecord-MENGE.
    perform bdc_field       using param2
                                  data . "采购订单数量
    counts = counts + 1 .
  ENDLOOP.

  counts = 1.
  loop at sumrecord where chkid = 'X'.
    param3 = 'EKPO-LGORT('.
    countchar = counts.
    condense countchar.
    if counts < 10 .
      CONCATENATE param3 '0' countchar ')' INTO param3 .
    else .
      CONCATENATE param3  countchar ')' INTO param3 .
    endif ..
    perform bdc_field       using param3
                                  sumrecord-LGORT . "采购订单数量
    counts = counts + 1 .
  ENDLOOP.


  perform bdc_dynpro      using 'SAPLSPO1' '0300'.
  perform bdc_field       using 'BDC_OKCODE'
                                '=YES'.
  CALL TRANSACTION 'ME21' USING bdcdata MODE pmode UPDATE umode
                         MESSAGES INTO messtab.

  DATA issuccess(1) TYPE C.
  issuccess = 'N'.
  LOOP AT messtab.
    issuccess = messtab-MSGTYP.
  ENDLOOP.
  if issuccess = 'S' .
    perform wtodata.
  endif.
  SET SCREEN 0.
  LEAVE SCREEN.
ENDFORM.                    " output

**&---------------------------------------------------------------------*
**&      Form  USER_COMMAND
**&---------------------------------------------------------------------*
**       text
**----------------------------------------------------------------------*
**      -->UCOMM      text
**      -->ENDFORM    text
**----------------------------------------------------------------------*
*form USER_COMMAND .
*  CASE sy-ucomm.
*    WHEN 'GEN'.
*      perform bapioutput.
*  ENDCASE.
*ENDFORM .                    "USER_COMMAND
*&---------------------------------------------------------------------*
*&      Form  wtodata
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM wtodata .
  DATA: indata like  ZSCPSDD.
  loop at selrecord .
    indata-RSNUM = selrecord-RSNUM .
    indata-MATNR = selrecord-MATNR .
    modify ZSCPSDD from indata.
*     append indata .
*     clear indata .
  endloop.
*       insert into ZSCPSDD
*     from TABLE indata.


ENDFORM.                    " wtodata
*&------------------------------------------------------------*
*&      Form  displaying
*&------------------------------------------------------------*
*       text
*-------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*-------------------------------------------------------------*
FORM displaying.

  TYPE-POOLS slis.
  DATA: ws_fieldcat TYPE slis_t_fieldcat_alv WITH HEADER LINE,
        ws_fieldgroups_tab TYPE slis_t_sp_group_alv,
        ws_layout          TYPE slis_layout_alv,
        ws_sortfields_tab  TYPE slis_t_sortinfo_alv WITH HEADER LINE,
        ws_events          TYPE slis_t_event.
  DATA: v_repid LIKE sy-repid.
  DATA: nn TYPE i VALUE 0.
  DATA: title TYPE lvc_title.

  SORT sumrecord BY matnr .

  DEFINE hout.
    nn = nn + 1.
    ws_fieldcat-tabname   = 'SUMRECORD'.
    ws_fieldcat-fieldname = '&1'.
    ws_fieldcat-seltext_m =  &2.
    ws_fieldcat-col_pos   =  nn.
    ws_fieldcat-outputlen =  &3.
*    ws_fieldcat-datatype  = '&4'.
    ws_fieldcat-do_sum    = '&4'.
    ws_fieldcat-lzero     = 'X'.
    append ws_fieldcat.
    clear ws_fieldcat.
  END-OF-DEFINITION.

*  hout ebeln          '配送单号'     10 char ''.
*  hout ebelp          '项目'         10 char ''.
  hout matnr          '物料号'       18   ''.
  hout maktx          '物料描述'     40   ''.
  hout EEIND          '交货日期'     8  ''.
*  hout werks          '收货工厂'     08 char ''.
  hout lgort          '交货地点'       06   ''.
  hout arbpl          '工作中心'         8   ''.
  hout BDMNG          '需求量' 13 ''.
  hout LABST          '库存量' 13  ''.
  hout ZTKCL          '在途量' 13  ''.
  hout menge          '配送数量' 13   ''.
*  hout KONNR          '框架协议' 18 char ''.
*  hout wamng          '已配送量'     18 quan ''.
*  hout chayi          '配送差额'     18 quan ''.
*  hout labst          '现有库存'     18 quan ''.
*  hout insme          '在检库存'     18 quan ''.
*  hout prueflos       '检验批号'     18 char ''.
*  hout vbeln          '交货单号'     18 char ''.
*  hout jyp_sl         '进货数量'     18 quan ''.
*  hout jjfx_sl        '紧急放行数量' 18 quan ''.
*  hout mblnr          '物料凭证编号' 12 char ''.
*  hout zflag1         '已检验收货'   10 char ''.
*  hout zflag2         '已发货过账'   10 char ''.
*


  MOVE '生成转储拣配单' TO title.
  ws_layout-zebra             = 'X'.
  ws_layout-get_selinfos      = ''.
  ws_layout-colwidth_optimize = 'X'.
  ws_layout-detail_popup      = 'X'.
  ws_layout-no_keyfix         = 'X'.
*  WS_layout-colwidth_optimize = 'X'.
*  WS_LAYOUT-totals_before_items = 'X'.
  ws_layout-box_fieldname     = 'CHKID'.

  v_repid = sy-repid.

  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      i_callback_program       = v_repid
      i_callback_pf_status_set = 'MENU_SET'
      i_callback_user_command  = 'EXECUTE_COMMAND'
      is_layout                = ws_layout
      it_fieldcat              = ws_fieldcat[]
      it_special_groups        = ws_fieldgroups_tab[]
      it_sort                  = ws_sortfields_tab[]
      it_events                = ws_events[]
      i_grid_title             = title
    TABLES
      t_outtab                 = sumrecord
    EXCEPTIONS
      program_error            = 1
      OTHERS                   = 2.


ENDFORM.                    " displaying
*&---------------------------------------------------------------------*
*&      Form  menu_set
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->RT_EXTAB   text
*----------------------------------------------------------------------*
FORM menu_set USING rt_extab TYPE slis_t_extab..

  SET PF-STATUS 'SCPSDD001' .
ENDFORM.                    "menu_set

*&---------------------------------------------------------------------*
*&      Form  execute_command
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->R_UCOMM      text
*      -->RS_SELFIELD  text
*----------------------------------------------------------------------*
FORM execute_command USING r_ucomm LIKE sy-ucomm
                        rs_selfield TYPE slis_selfield.
  CASE r_ucomm.
    WHEN 'GEN'.
*       perform output.
*      clear msg .
      perform bapioutput.
*      MESSAGE msg type 'I'."msgtype .
    when '&IC1'.
      if not rs_selfield-value is initial.
        case rs_selfield-fieldname.
          when 'MATNR' OR 'MAKTX'  OR 'EEIND' OR 'LGORT' OR 'ARBPL' OR 'BDMNG' OR 'LABST' OR 'ZTKCL' OR 'MENGE'.
            clear mdezx.
            refresh mdezx.
            clear mdpsx.
            refresh mdpsx.
            clear mdsux .
            refresh mdsux.
            READ TABLE sumrecord INDEX rs_selfield-tabindex INTO sumrecord_wa.
            call function 'MD_STOCK_REQUIREMENTS_LIST_API'
              EXPORTING
                matnr = sumrecord_wa-matnr
                werks = sumrecord_wa-werks
              TABLES
                mdpsx = mdpsx
                mdezx = mdezx
                mdsux = mdsux.
            if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
            endif.
            clear itab_mrp.
            refresh itab_mrp.
            LOOP AT record where matnr = sumrecord_wa-matnr and werks = sumrecord_wa-werks and lgort = sumrecord_wa-lgort.
              itab_mrp-RSNUM  =  record-RSNUM  .
              itab_mrp-RSPOS  =  record-RSPOS  .
              itab_mrp-MATNR  =  record-MATNR  .
              itab_mrp-MAKTX  =  record-MAKTX  .
              itab_mrp-BDMNG  =  record-BDMNG  .
              itab_mrp-BDTER  =  record-BDTER  .
              itab_mrp-LABST  =  record-LABST  .
              itab_mrp-MENGE  =  record-MENGE  .
              itab_mrp-WERKS  =  record-WERKS  .
              itab_mrp-LGORT  =  record-LGORT  .
              itab_mrp-AUFNR  =  record-AUFNR  .
              itab_mrp-GSTRP  =  record-GSTRP  .
              itab_mrp-ARBPL  =  record-ARBPL  .
              itab_mrp-AUFPL  =  record-AUFPL  .
              itab_mrp-APLZL  =  record-APLZL  .
              itab_mrp-DELB0          =    'OrdRes'.
*              select single PLNBEZ from afko
*              into itab_mrp-PLNBEZ
*              where AUFNR = itab_mrp-AUFNR.
              loop at mdpsx into wa_mdpsx where DELKZ = 'AR' and DAT00 = itab_mrp-BDTER and MNG01 = itab_mrp-BDMNG
              and DEL12 = itab_mrp-AUFNR.
                itab_mrp-PLNBEZ  = wa_mdpsx-BAUGR.
              ENDLOOP.
              if itab_mrp-PLNBEZ is initial.
                itab_mrp-PLNBEZ = itab_mrp-aufnr.
              endif.

              append itab_mrp.
            ENDLOOP.


            LOOP AT ITAB_MRP(物料需求计划).
                 select single PLNBEZ from afko
                 into itab_mrp-matnr
                 where aufnr = itab_mrp-aufnr.

                 select single maktx from makt
                 into itab_mrp-maktx
                 where matnr = itab_mrp-matnr.

                 modify itab_mrp.
            ENDLOOP.
            perform displaying2.
        endcase.
      endif.
  ENDCASE.
ENDFORM.                    "execute_command
*&---------------------------------------------------------------------*
*&      Form  bapioutput
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM bapioutput .
  DATA: begin of artab occurs 0,
        arbpl like crhd-arbpl,
        END OF artab.

  LOOP AT sumrecord where CHKID = 'X'.
    artab-arbpl = sumrecord-arbpl.
    append artab.
  ENDLOOP.

  sort artab by arbpl.
  delete adjacent duplicates from artab.

  LOOP AT artab.
    clear itab_poheader.
    clear itab_poheader[].
    clear itab_poheaderx.
    clear itab_poheaderx[].
    clear itab_poitems.
    clear itab_poitems[].
    clear itab_poitemx.
    clear itab_poitemx[].
    clear itab_itemsche.
    clear itab_itemsche[].
    clear itab_itemschex.
    clear itab_itemschex[].

    itab_poheader-doc_date =  sy-datum."P_EINDT."recordhead-EKORG_004."P_EINDT."P_BDTER."sy-datum.
    itab_poheader-creat_date = sy-datum.
    itab_poheader-doc_type = recordhead-BSART_002."'ZDB'."ZDB
*  itab_poheader-comp_code = BUKRS."'1001'.
*  itab_poheader-comp_code = bukrs."1001三一重工
    itab_poheader-purch_org = recordhead-EKORG_004."'1100'."采购组织
    itab_poheader-pur_group = recordhead-EKGRP_005."'F01'."采购组
    itab_poheader-vendor = recordhead-LIFNR_001."P_LIFNR ."供应商帐户号
*  itab_poheader-currency = 'RMB'.
*  itab_itemsche-
    APPEND itab_poheader.
    itab_poheaderx-doc_date = 'X'.
    itab_poheaderx-doc_type = 'X'.
*  itab_poheaderx-comp_code = 'X'.
    itab_poheaderx-creat_date = 'X'.
    itab_poheaderx-vendor = 'X'.
    itab_poheaderx-purch_org = 'X'.
    itab_poheaderx-pur_group = 'X'.
*  itab_poheaderx-currency = 'X'.
    APPEND itab_poheaderx.

*****LOOP
    DATA: po_item(5) type N,
          ps_item(4) type N.
    po_item = '10' .
    ps_item = '1'.
    LOOP AT sumrecord where CHKID = 'X' and arbpl = artab-arbpl.
      itab_poitems-po_item = po_item.
      itab_poitems-material = sumrecord-MATNR.
      itab_poitems-stge_loc = sumrecord-LGORT.
*  itab_poitems-gr_to_date = sy-datum.
      itab_poitems-plant = sumrecord-WERKS.
      itab_poitems-quantity = sumrecord-MENGE.
*  itab_poitems-agreement = sumrecord-KONNR.
*  itab_poitems-agmt_item = sumrecord-KTPNR .
      itab_poitems-tax_code = 'J1'.                         "J1税码
      itab_poitems-trackingno = sumrecord-ARBPL.
      APPEND itab_poitems.

      itab_poitemx-po_item = po_item.
      itab_poitemx-material = 'X'.
      itab_poitemx-quantity = 'X'.
      itab_poitemx-gr_to_date = 'X'.
      itab_poitemx-plant = 'X'.
      itab_poitemx-stge_loc = 'X'.
      itab_poitemx-tax_code = 'X'.
*  itab_poitemx-agreement ='X'.
*  itab_poitemx-agmt_item ='X'.
      itab_poitemx-trackingno = 'X'.
      APPEND itab_poitemx.
      itab_itemsche-PO_ITEM = po_item.
      itab_itemsche-SCHED_LINE = ps_item.
*  itab_itemsche-DEL_DATCAT_EXT = '1'.
      itab_itemsche-DELIVERY_DATE = P_EINDT."P_EINDT."P_BDTER."sy-datum.
      itab_itemsche-QUANTITY = sumrecord-MENGE.
      APPEND itab_itemsche.
      itab_itemschex-PO_ITEM = po_item.
      itab_itemschex-SCHED_LINE = ps_item.
      itab_itemschex-PO_ITEMX = 'X'.
      itab_itemschex-SCHED_LINEX = 'X'.
*  itab_itemschex-DEL_DATCAT_EXT = 'X'.
      itab_itemschex-DELIVERY_DATE = 'X'.
      APPEND itab_itemschex.
      po_item = po_item + 10 .
      ps_item = ps_item + 1.
    ENDLOOP.
    perform create_po.
  ENDLOOP.
  IF instab[] is not initial.
    insert  zdscdd  FROM TABLE  instab .
    commit work.
    clear instab[].
  ENDIF.
ENDFORM.                    " bapioutput
*&---------------------------------------------------------------------*
*&      Form  create_po
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM create_po .

  CALL FUNCTION 'BAPI_PO_CREATE1'
    EXPORTING
      poheader    = itab_poheader
      poheaderx   = itab_poheaderx
    TABLES
      return      = return
      poitem      = itab_poitems
      poitemx     = itab_poitemx
      POSCHEDULE  = itab_itemsche
      poschedulex = itab_itemschex.

  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
*  msgtype = 'S'.
  Loop at return where type = 'S' or type = 'E'.
*    msgtab-msg = return-message.
    concatenate return-message return-MESSAGE_V1 return-MESSAGE_V2 return-MESSAGE_V3 return-MESSAGE_V4 into msgtab-msg.
    msgtab-msgtype = return-type.

    message msgtab-msg type 'I'. "return-type.

    IF return-type = 'S' and return-ID = '06' and return-Number = '017'.
      instab-ebeln = return-MESSAGE_V2.
      instab-werks = P_WERKS.
      instab-AEDAT = sy-datum.
      append instab.
    ENDIF.
  ENDLOOP.


*  IF msgtype = 'S'.
*    delete sumrecord where CHKID = 'X'.
*  ENDIF.

ENDFORM.                    " create_po
*&---------------------------------------------------------------------*
*&      Form  write_zlog
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM write_zlog .
  data:wa_zlog type zlog.
  wa_zlog-zdate = sy-datum.
  wa_zlog-ztime = sy-uzeit.
  wa_zlog-USERNAME = sy-uname.
  wa_zlog-TCODE = sy-tcode.
  wa_zlog-PGMNA = sy-repid.
  insert into zlog values wa_zlog.
ENDFORM.                    " write_zlog
*&------------------------------------------------------------*
*&      Form  displaying2
*&------------------------------------------------------------*
*       text
*-------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*-------------------------------------------------------------*
FORM displaying2.

  TYPE-POOLS slis.
  DATA: ws_fieldcat TYPE slis_t_fieldcat_alv WITH HEADER LINE,
        ws_fieldgroups_tab TYPE slis_t_sp_group_alv,
        ws_layout          TYPE slis_layout_alv,
        ws_sortfields_tab  TYPE slis_t_sortinfo_alv WITH HEADER LINE,
        ws_events          TYPE slis_t_event.
  DATA: v_repid LIKE sy-repid.
  DATA: nn TYPE i VALUE 0.
  DATA: title TYPE lvc_title.

  DEFINE hout.
    nn = nn + 1.
    ws_fieldcat-tabname   = 'ITAB_MRP(物料需求计划)'.
    ws_fieldcat-fieldname = '&1'.
    ws_fieldcat-seltext_m =  &2.
    ws_fieldcat-col_pos   =  nn.
    ws_fieldcat-outputlen =  &3.
*    ws_fieldcat-datatype  = '&4'.
    ws_fieldcat-do_sum    = '&4'.
    ws_fieldcat-lzero     = 'X'.
    append ws_fieldcat.
    clear ws_fieldcat.
  END-OF-DEFINITION.


  hout BDTER          '订单需求日期'       8   ''.
  hout AUFNR          '订单号'     12  ''.
  hout MATNR          '订单物料'     18  ''.
  hout MAKTX          '订单物料描述'       40   ''.
  hout DELB0          'MRP(物料需求计划)元素'         6   ''.
  hout PLNBEZ          'MRP(物料需求计划)元素数据' 18 ''.
  hout BDMNG          '需求数量' 13  ''.
  hout LGORT          '交货地点' 4 ''.
  hout ARBPL          '工作中心' 13   ''.


  MOVE 'MRP(物料需求计划)元素' TO title.
  ws_layout-zebra             = 'X'.
  ws_layout-get_selinfos      = ''.
  ws_layout-colwidth_optimize = 'X'.
  ws_layout-detail_popup      = 'X'.
  ws_layout-no_keyfix         = 'X'.
*  WS_layout-colwidth_optimize = 'X'.
*  WS_LAYOUT-totals_before_items = 'X'.
*  ws_layout-box_fieldname     = 'CHKID'.

  v_repid = sy-repid.

  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      i_callback_program       = v_repid
      i_callback_pf_status_set = 'MENU_SET'
      i_callback_user_command  = 'EXECUTE_COMMAND'
      is_layout                = ws_layout
      it_fieldcat              = ws_fieldcat[]
      it_special_groups        = ws_fieldgroups_tab[]
      it_sort                  = ws_sortfields_tab[]
      it_events                = ws_events[]
      i_grid_title             = title
    TABLES
      t_outtab                 = ITAB_MRP(物料需求计划)
    EXCEPTIONS
      program_error            = 1
      OTHERS                   = 2.


ENDFORM.                    " displaying2

  adJustImgs($('postbody')); linkTxt($('postbody'));  

 

0
相关文章