A BDC Programe
REPORT ZZW_BDC_MM01 .
***********************************************************************
*
* Author: Lilo.Zhu
*
* Date: 05/12/2006
*
* Keyword: T-Code-->SHDB (HAND RECORDERTCODE),SCAT
*
* Description:
*
***********************************************************************
*
* Last Modified Date:
*
* Log:
*
***********************************************************************
*----------------------------------------------------------------------
* Define BDC Properties Table ( Hand BDC Record T-Code: SHDB )
*----------------------------------------------------------------------
DATA : BEGIN OF I_BDCDATA OCCURS 0,
PROGRAM LIKE BDCDATA-PROGRAM, "Program
DYNPRO LIKE BDCDATA-DYNPRO, "Screen
DYNBEGIN LIKE BDCDATA-DYNBEGIN, "Start ID
FNAM LIKE BDCDATA-FNAM, "Field Name
FVAL LIKE BDCDATA-FVAL, "Field Value
END OF I_BDCDATA.
DATA: BEGIN OF ITAB_MATERIAL OCCURS 0,
MATERIAL_NO(9),
END OF ITAB_MATERIAL.
*-----------------------------------------------------------------------
* File data to inner table
*-----------------------------------------------------------------------
ITAB_MATERIAL-MATERIAL_NO = 'ZW0101'.
APPEND ITAB_MATERIAL.
ITAB_MATERIAL-MATERIAL_NO = 'ZW0102'.
APPEND ITAB_MATERIAL.
*-----------------------------------------------------------------------
* START-OF-SELECTION
*-----------------------------------------------------------------------
START-OF-SELECTION.
LOOP AT ITAB_MATERIAL.
PERFORM APPEND_MM01 USING ITAB_MATERIAL-MATERIAL_NO.
PERFORM RUN_BDC.
ENDLOOP.
*-----------------------------------------------------------------------
* FORM APPEND_DATA_MM01
*-----------------------------------------------------------------------
FORM APPEND_MM01 USING FVAL LIKE ITAB_MATERIAL-MATERIAL_NO.
CLEAR I_BDCDATA.
CLEAR I_BDCDATA[].
*-----------------------------------------------------------------------
* Program->SAPLMGMM Screen->0060
*-----------------------------------------------------------------------
I_BDCDATA-PROGRAM = 'SAPLMGMM'.
I_BDCDATA-DYNPRO = '0060'.
I_BDCDATA-DYNBEGIN = 'X'.
APPEND I_BDCDATA.
CLEAR I_BDCDATA.
I_BDCDATA-FNAM = 'BDC_CURSOR'.
I_BDCDATA-FVAL = 'RMMG1-MATNR'.
APPEND I_BDCDATA.
CLEAR I_BDCDATA.
I_BDCDATA-FNAM = 'BDC_OKCODE'.
I_BDCDATA-FVAL = '=AUSW'.
APPEND I_BDCDATA.
CLEAR I_BDCDATA.
I_BDCDATA-FNAM = 'RMMG1-MATNR'.
I_BDCDATA-FVAL = FVAL.
APPEND I_BDCDATA.
CLEAR I_BDCDATA.
I_BDCDATA-FNAM = 'RMMG1-MBRSH'.
I_BDCDATA-FVAL = 'C'.
APPEND I_BDCDATA.
CLEAR I_BDCDATA.
I_BDCDATA-FNAM = 'RMMG1-MTART'.
I_BDCDATA-FVAL = 'WERB'.
APPEND I_BDCDATA.
CLEAR I_BDCDATA.
*-----------------------------------------------------------------------
* Program->SAPLMGMM Screen->0070
*-----------------------------------------------------------------------
I_BDCDATA-PROGRAM = 'SAPLMGMM'.
I_BDCDATA-DYNPRO = '0070'.
I_BDCDATA-DYNBEGIN = 'X'.
APPEND I_BDCDATA.
CLEAR I_BDCDATA.
I_BDCDATA-FNAM = 'BDC_CURSOR'.
I_BDCDATA-FVAL = 'MSICHTAUSW-DYTXT(01)'.
APPEND I_BDCDATA.
CLEAR I_BDCDATA.
I_BDCDATA-FNAM = 'BDC_OKCODE'.
I_BDCDATA-FVAL = '=ENTR'.
APPEND I_BDCDATA.
CLEAR I_BDCDATA.
I_BDCDATA-FNAM = 'MSICHTAUSW-KZSEL(01)'.
I_BDCDATA-FVAL = 'X'.
APPEND I_BDCDATA.
CLEAR I_BDCDATA.
*-----------------------------------------------------------------------
* Program->SAPLMGMM Screen->4004
*-----------------------------------------------------------------------
I_BDCDATA-PROGRAM = 'SAPLMGMM'.
I_BDCDATA-DYNPRO = '4004'.
I_BDCDATA-DYNBEGIN = 'X'.
APPEND I_BDCDATA.
CLEAR I_BDCDATA.
I_BDCDATA-FNAM = 'BDC_OKCODE'.
I_BDCDATA-FVAL = '=BU'.
APPEND I_BDCDATA.
CLEAR I_BDCDATA.
I_BDCDATA-FNAM = 'BDC_CURSOR'.
I_BDCDATA-FVAL = 'MAKT-MAKTX'.
APPEND I_BDCDATA.
CLEAR I_BDCDATA.
I_BDCDATA-FNAM = 'MAKT-MAKTX'.
I_BDCDATA-FVAL = 'LILO MM01 BDC TEST'.
APPEND I_BDCDATA.
CLEAR I_BDCDATA.
I_BDCDATA-FNAM = 'MARA-MEINS'.
I_BDCDATA-FVAL = '001'.
APPEND I_BDCDATA.
CLEAR I_BDCDATA.
I_BDCDATA-FNAM = 'MARA-BISMT'.
I_BDCDATA-FVAL = 'ZW1843'.
APPEND I_BDCDATA.
CLEAR I_BDCDATA.
I_BDCDATA-FNAM = 'MARA-MTPOS_MARA'.
I_BDCDATA-FVAL = 'NORM'.
APPEND I_BDCDATA.
CLEAR I_BDCDATA.
ENDFORM.
*-----------------------------------------------------------------------
* FORM RUN_BDC For MM01 (A->Show Mode, N->Hide Mode)
*-----------------------------------------------------------------------
FORM RUN_BDC.
CALL TRANSACTION 'MM01' USING I_BDCDATA MODE 'A'.
ENDFORM.
程序运行效果图:
1. 手动录制部分--T-Code : SHDB
2.运行 DBC 程序效果: