首页 > 其他分享 >BDC

BDC

时间:2023-04-14 22:23:44浏览次数:42  
标签:BDC PERFORM FIELDS SUBSCR USING APPEND

*&---------------------------------------------------------------------*
*& Report  ZBDC1
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT ZBDC1.
TYPE-POOLS:SLIS.

TYPES:BEGIN OF GTY_MATERIAL,
  MATNR(18) TYPE C,"物料编号
  MAKTX(40) TYPE C,"物料描述
  BISMT(40) TYPE C,"旧物料号
  BRGEW(50) TYPE C,"毛重
  NTGEW(50) TYPE C,"净重
  GEWEI(10) TYPE C,"重量单位
END OF GTY_MATERIAL.


DATA LT_MATERIAL TYPE TABLE OF GTY_MATERIAL.
DATA WA_MATERIAL TYPE GTY_MATERIAL.
DATA BDCDATA TYPE TABLE OF BDCDATA WITH HEADER LINE.


PERFORM APPEND_BDCDATA.

call TRANSACTION 'MM02' USING bdcdata MODE 'A'.

IF sy-subrc = 0.
WRITE 'BDC操作成功'.
ENDIF.



FORM APPEND_BDCDATA.

  PERFORM APPEND_SCREEN USING 'SAPLMGMM'               '0060'.
  PERFORM APPEND_FIELDS USING 'BDC_CURSOR'             'RMMG1-MATNR'.
  PERFORM APPEND_FIELDS USING 'RMMG1-MATNR'            'A01'.
  PERFORM APPEND_FIELDS USING 'BDC_OKCODE'             '=ENTR'.

  PERFORM APPEND_SCREEN USING 'SAPLMGMM'               '0070'.
  PERFORM APPEND_FIELDS USING 'BDC_CURSOR'             'MSICHTAUSW-DYTXT(01)'.
  PERFORM APPEND_FIELDS USING 'BDC_OKCODE'             '=ENTR'.
  PERFORM APPEND_FIELDS USING 'MSICHTAUSW-KZSEL(01)'   'X'.

  PERFORM APPEND_SCREEN USING 'SAPLMGMM'               '4004'.
  PERFORM APPEND_FIELDS USING 'BDC_OKCODE'             '/00'.
  PERFORM APPEND_FIELDS USING 'BDC_SUBSCR'             'SAPLMGMM                                2004TABFRA1'.
  PERFORM APPEND_FIELDS USING 'BDC_SUBSCR'   'SAPLMGD1                                1002SUB1'.
  PERFORM APPEND_FIELDS USING 'MAKT-MAKTX'             '金士顿 (Kingston) FURY 64GB'.
  PERFORM APPEND_FIELDS USING 'MARA-MEINS'             'SAPLMGD1                                2001SUB2'.
  PERFORM APPEND_FIELDS USING 'BDC_OKCODE'             'EA'.
  PERFORM APPEND_FIELDS USING 'MARA-MATKL'             '01'.
  PERFORM APPEND_FIELDS USING 'MARA-BISMT'             'NC001'.
  PERFORM APPEND_FIELDS USING 'BDC_SUBSCR'             'SAPLMGD1                                2561SUB3'.
  PERFORM APPEND_FIELDS USING 'BDC_SUBSCR'             'SAPLMGD1                                2007SUB4'.
  PERFORM APPEND_FIELDS USING 'BDC_CURSOR'             'MARA-NTGEW'.
  PERFORM APPEND_FIELDS USING 'MARA-BRGEW'             '200'.
  PERFORM APPEND_FIELDS USING 'MARA-NTGEW'             '300'.
  PERFORM APPEND_FIELDS USING 'BDC_SUBSCR'             'SAPLMGD1                                2005SUB5'.
  PERFORM APPEND_FIELDS USING 'BDC_SUBSCR'             'SAPLMGD1                                2011SUB6'.
  PERFORM APPEND_FIELDS USING 'BDC_SUBSCR'             'SAPLMGD1                                2033SUB7'.
  PERFORM APPEND_FIELDS USING 'BDC_SUBSCR'             'SAPLMGD1                                0001SUB8'.
  PERFORM APPEND_FIELDS USING 'BDC_SUBSCR'             'SAPLMGD1                                0001SUB9'.
  PERFORM APPEND_FIELDS USING 'BDC_SUBSCR'             'SAPLMGD1                                0001SUB10'.

  PERFORM APPEND_SCREEN USING 'SAPLMGMM'               '4004'.
  PERFORM APPEND_FIELDS USING 'BDC_OKCODE'             'BU'.
  PERFORM APPEND_FIELDS USING 'BDC_SUBSCR'             'SAPLMGMM                                2004TABFRA1'.
  PERFORM APPEND_FIELDS USING 'BDC_SUBSCR'             'SAPLMGD1                                1002SUB1'.
  PERFORM APPEND_FIELDS USING 'MAKT-MAKTX'             '金士顿 (Kingston) FURY 64GB'.
  PERFORM APPEND_FIELDS USING 'BDC_SUBSCR'             'SAPLMGD1                                2001SUB2'.
  PERFORM APPEND_FIELDS USING 'MARA-MEINS' 'EA'.
  PERFORM APPEND_FIELDS USING 'MARA-MATKL' '01'.
  PERFORM APPEND_FIELDS USING 'MARA-BISMT' 'NC001'.
  PERFORM APPEND_FIELDS USING 'BDC_SUBSCR' 'SAPLMGD1                                2561SUB3'.
  PERFORM APPEND_FIELDS USING 'BDC_SUBSCR' 'SAPLMGD1                                2007SUB4'.
  PERFORM APPEND_FIELDS USING 'BDC_CURSOR' 'MARA-NTGEW'.
  PERFORM APPEND_FIELDS USING 'MARA-BRGEW' '200'.
  PERFORM APPEND_FIELDS USING 'MARA-NTGEW' '300'.
  PERFORM APPEND_FIELDS USING 'MARA-GEWEI' 'KG'.
  PERFORM APPEND_FIELDS USING 'BDC_SUBSCR' 'SAPLMGD1                                2005SUB5'.
  PERFORM APPEND_FIELDS USING 'BDC_SUBSCR' 'SAPLMGD1                                2011SUB6'.
  PERFORM APPEND_FIELDS USING 'BDC_SUBSCR' 'SAPLMGD1                                2033SUB7'.
  PERFORM APPEND_FIELDS USING 'BDC_SUBSCR' 'SAPLMGD1                                0001SUB8'.
  PERFORM APPEND_FIELDS USING 'BDC_SUBSCR' 'SAPLMGD1                                0001SUB9'.
  PERFORM APPEND_FIELDS USING 'BDC_SUBSCR' 'SAPLMGD1                                0001SUB10'.
ENDFORM.



"设置屏幕
FORM APPEND_SCREEN USING VALUE(P_PROGRAM)  VALUE(P_DYNPRO).
  CLEAR BDCDATA.
  BDCDATA-PROGRAM = P_PROGRAM.
  BDCDATA-DYNPRO = P_DYNPRO.
  BDCDATA-DYNBEGIN = 'X'.
  BDCDATA-FNAM = ''.
  BDCDATA-FVAL = ''.
  APPEND BDCDATA.
ENDFORM.

"设置字段
FORM APPEND_FIELDS USING VALUE(P_FIELD) VALUE(P_VALUE).
  CLEAR BDCDATA.
  BDCDATA-FNAM = P_FIELD.
  BDCDATA-FVAL = P_VALUE.
  APPEND BDCDATA.
ENDFORM.

 

标签:BDC,PERFORM,FIELDS,SUBSCR,USING,APPEND
From: https://www.cnblogs.com/hua900822/p/17320111.html

相关文章