Recording a transaction using SHDB

Recording a transaction using SHDB in SAP

+ -

RECORDING METHOD:

Since, it is very difficult to find technical information of each field on the screen, we go for a method called as “Recording method”.

The recording method is going to record all the fields in the transaction and it generated the technical information such as program name, screen no, field name, field value for each field on the SAP screen.

By using the recording method, it is very easy to create a BDC program.

Steps for recording a transaction.

SHDB is the T-code for recording method, go to SHDB, list of recordings will be displayed( if any), click on New Recording to create new recording.

Recording method in SAP ABAP

A pop up will open, provide a recording name ZSAPN_MM01, provide transaction code as MM01 and click recording.

Recording method in SAP ABAP

It will go to material creation screen, provide values for material creation.

Recording method in SAP ABAP

A pop up will open, select basic data1 and enter

Recording method in SAP ABAP

Enter below details.

Recording method in SAP ABAP

Click Save( Ctrl S), it will go to a screen with recording code.

Recording method in SAP ABAP

Click Save, go back, you will go to recording overview screen and click on program button to create a program for this.

Recording method in SAP ABAP

Provide a program name and enter.

Recording method in SAP ABAP

Provide title, type and click on source code.

Recording method in SAP ABAP

Save it in a local object, you will find the below code in the program
report ZSAPN_MM01
       no standard page heading line-size 255.

include bdcrecx1.

parameters: dataset(132) lower case.
***    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,
* data element: MATNR
        MATNR_001(018),
* data element: MBRSH
        MBRSH_002(001),
* data element: MTART
        MTART_003(004),
* data element: XFELD
        KZSEL_01_004(001),
* data element: MATNR
        MATNR_005(018),
* data element: MBRSH
        MBRSH_006(001),
* data element: MTART
        MTART_007(004),
* data element: XFELD
        KZSEL_01_008(001),
* data element: MAKTX
        MAKTX_009(040),
* data element: MEINS
        MEINS_010(003),
      end of record.

*** End generated data section ***

start-of-selection.

perform open_dataset using dataset.
perform open_group.

do.

read dataset dataset into record.
if sy-subrc <> 0. exit. endif.

perform bdc_dynpro      using 'SAPLMGMM' '0060'.
perform bdc_field       using 'BDC_CURSOR'
                              'RMMG1-MTART'.
perform bdc_field       using 'BDC_OKCODE'
                              '=ENTR'.
perform bdc_field       using 'RMMG1-MATNR'
                              record-MATNR_001.
perform bdc_field       using 'RMMG1-MBRSH'
                              record-MBRSH_002.
perform bdc_field       using 'RMMG1-MTART'
                              record-MTART_003.
perform bdc_dynpro      using 'SAPLMGMM' '0070'.
perform bdc_field       using 'BDC_CURSOR'
                              'MSICHTAUSW-DYTXT(01)'.
perform bdc_field       using 'BDC_OKCODE'
                              '=ENTR'.
perform bdc_field       using 'MSICHTAUSW-KZSEL(01)'
                              record-KZSEL_01_004.
perform bdc_dynpro      using 'SAPLMGMM' '0060'.
perform bdc_field       using 'BDC_CURSOR'
                              'RMMG1-MATNR'.
perform bdc_field       using 'BDC_OKCODE'
                              '=ENTR'.
perform bdc_field       using 'RMMG1-MATNR'
                              record-MATNR_005.
perform bdc_field       using 'RMMG1-MBRSH'
                              record-MBRSH_006.
perform bdc_field       using 'RMMG1-MTART'
                              record-MTART_007.
perform bdc_dynpro      using 'SAPLMGMM' '0070'.
perform bdc_field       using 'BDC_CURSOR'
                              'MSICHTAUSW-DYTXT(01)'.
perform bdc_field       using 'BDC_OKCODE'
                              '=ENTR'.
perform bdc_field       using 'MSICHTAUSW-KZSEL(01)'
                              record-KZSEL_01_008.
perform bdc_dynpro      using 'SAPLMGMM' '4004'.
perform bdc_field       using 'BDC_OKCODE'
                              '/00'.
perform bdc_field       using 'MAKT-MAKTX'
                              record-MAKTX_009.
perform bdc_field       using 'BDC_CURSOR'
                              'MARA-MEINS'.
perform bdc_field       using 'MARA-MEINS'
                              record-MEINS_010.
perform bdc_dynpro      using 'SAPLSPO1' '0300'.
perform bdc_field       using 'BDC_OKCODE'
                              '=YES'.
perform bdc_transaction using 'MM01'.

enddo.

perform close_group.
perform close_dataset using dataset.

In next lessons we will learn how to use recording for BDC.

Learner Questions


No Questions by learners, be first one to ask ..!!

    Please Sign in to ask a question

    Was this lesson helpful to you? Yes No 48 People out of 54 think this lesson helpful


    Lesson Navigation

    ←Previous Chapter
    Next Chapter →