Customize ABAP Program to Mass run MD02

4.6x

report ZBDCMD02 no standard page heading line-size 255.
*
*  Author by  : SAP ABAP/4 Programming, Basis Administration, Configuration Hints and Tips
*                   https://www.gotothings.com
*
TABLES: MARC,
        MARA.

***    DO NOT CHANGE - the generated data section - DO NOT CHANGE    ***
*
*   If it is nessesary to change the data section use the rules:
*   1.) Each definition of a field exists of two lines
*   2.) The first line shows exactly the comment
*       '* data element: ' followed with the data element
*       which describes the field.
*       If you don't have a data element use the
*       comment without a data element name
*   3.) The second line shows the fieldname of the
*       structure, the fieldname must consist of
*       a fieldname and optional the character '_' and
*       three numbers and the field length in brackets
*   4.) Each field must be type C.
*
*** Generated data section with specific formatting - DO NOT CHANGE  ***
data: begin of record OCCURS 0,
* data element: MATNR
        MATNR_001(018),
* data element: WERKS_D
        WERKS_002(004),
* data element: VERSL
        VERSL_003(005),
* data element: BANER
        BANER_004(001),
* data element: LIFKZ
        LIFKZ_005(001),
* data element: DISER
        DISER_006(001),
* data element: PLMOD
        PLMOD_007(001),
* data element: TRMPL
        TRMPL_008(001),
* data element: PLALL
        PLALL_009(001),
* data element: ANZLS
        ANZLS_010(001),
      end of record.

*** End generated data section ***
DATA: D_LINE(5)  TYPE N.

SELECT-OPTIONS: S_MATNR FOR MARC-MATNR MEMORY ID M01.
SELECT-OPTIONS: S_WERKS FOR MARC-WERKS OBLIGATORY.

SELECT * FROM MARC WHERE LVORM =  SPACE
                     AND MATNR IN S_MATNR
                     AND WERKS IN S_WERKS.
      CLEAR MARA.
      SELECT SINGLE * FROM MARA WHERE MATNR  = MARC-MATNR
                                 AND MTART IN ('HALB',
                                                'FERT').

      IF SY-SUBRC <> 0.   CONTINUE.   ENDIF.

      RECORD-MATNR_001 = MARC-MATNR.
      RECORD-WERKS_002 = MARC-WERKS.
      RECORD-VERSL_003 = 'NETCH'.
      RECORD-BANER_004 = 2.
      RECORD-LIFKZ_005 = 3.
      RECORD-DISER_006 = 1.
      RECORD-PLMOD_007 = 3.
      RECORD-TRMPL_008 = 2.
      RECORD-PLALL_009 = 'X'.
      RECORD-ANZLS_010 = 'X'.

      ADD  1  TO  D_LINE.
      WRITE:/ D_LINE NO-ZERO, RECORD-MATNR_001, RECORD-WERKS_002.

      APPEND RECORD.
      CLEAR  RECORD.
ENDSELECT.

include bdcrecx1.

start-of-selection.
perform open_group.

LOOP AT RECORD.

perform bdc_dynpro      using 'SAPMM61X' '0150'.
perform bdc_field       using 'BDC_CURSOR'
                              'RM61X-MATNR'.
perform bdc_field       using 'BDC_OKCODE'
                              '/00'.
perform bdc_field       using 'RM61X-MATNR'
                              record-MATNR_001.
perform bdc_field       using 'RM61X-WERKS'
                              record-WERKS_002.
perform bdc_field       using 'RM61X-VERSL'
                              record-VERSL_003.
perform bdc_field       using 'RM61X-BANER'
                              record-BANER_004.
perform bdc_field       using 'RM61X-LIFKZ'
                              record-LIFKZ_005.
perform bdc_field       using 'RM61X-DISER'
                              record-DISER_006.
perform bdc_field       using 'RM61X-PLMOD'
                              record-PLMOD_007.
perform bdc_field       using 'RM61X-TRMPL'
                              record-TRMPL_008.
perform bdc_field       using 'RM61X-PLALL'
                              record-PLALL_009.
perform bdc_field       using 'RM61X-ANZLS'
                              record-ANZLS_010.
perform bdc_dynpro      using 'SAPMSSY0' '0120'.
perform bdc_field       using 'BDC_OKCODE'
                              '=XBAC'.
perform bdc_transaction using 'MD02'.

ENDLOOP.
perform close_group.

*--- End of Program
 

More Function Module
Functions / SAP Script / ALV

Tables
Database Table

ABAP Books List
ABAP/4 Certification, Programming, Smartforms, Sapscripts and Object Oriented Programming Books

Smart Forms
SAP Smartforms

ABAP Menu:
ABAP Example Hints and Tips

Return to Index:-
SAP ABAP/4 Programming, Basis Administration, Configuration Hints and Tips

(c) www.gotothings.com All material on this site is Copyright.
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk.
All product names are trademarks of their respective companies.  The site www.gotothings.com is in no way affiliated with SAP AG.
Any unauthorised copying or mirroring is prohibited.