Additional Field in MB52 Output Report

Program RM07MLBS is used to add the fields in the output of the report MB52.

The output are as follows

Additional Fields in MB52
Add the fields which has to be displayed in the structure BESTAND using implicit enhancement
Double click the subroutine LIST_OUTPUT as highlighted
Create an implicit enhancement in beginning of the form

Inside the enhancement write the below coding:

first add the fieldcatalog of the field needs to be displayed.

second add the logic which has to be displayed as below.

ENHANCEMENT 2  ZMB52_EXTRAFIELDS.    “active version
  data: wa_fcat LIKE LINE OF fieldcat,
          g_tabix LIKE sy-tabix.

    wa_fcat-fieldname = ‘LGPBE’.
    wa_fcat-tabname   = ‘BESTAND’.
    wa_fcat-seltext_m = ‘Storage Bin’.
    APPEND wa_fcat to fieldcat.
    CLEAR wa_fcat.

    wa_fcat-fieldname = ‘BISMT’.
    wa_fcat-tabname   = ‘BESTAND’.
    wa_fcat-seltext_m = ‘Old Material Number’.
    APPEND wa_fcat TO fieldcat.
    CLEAR wa_fcat.

  SELECT matnr,
         werks,
         lgort,
         lgpbe
    FROM mard
    INTO TABLE @Data(lt_mard)
          FOR ALL ENTRIES IN @bestand
          WHERE matnr = @bestand-matnr
          AND  werks = @bestand-werks
          AND  lgort = @bestand-lgort.

    SELECT matnr,
           bismt
      FROM mara
      INto TABLE @data(lt_mara)
          FOR ALL ENTRIES IN @bestand
          WHERE matnr = @bestand-matnr.

    LOOP AT bestand[] ASSIGNING FIELD-SYMBOL(<lfs_output>).
    READ TABLE lt_mard INTO DATA(ls_mard) WITH KEY matnr = <lfs_output>-matnr
                                                   werks = <lfs_output>-werks
                                                   lgort = <lfs_output>-lgort.
      IF sy-subrc = 0.
      <lfs_output>-lgpbe = ls_mard-lgpbe.
      ENDIF.
    READ TABLE lt_mara INTO data(ls_mara) with key matnr = <lfs_output>-matnr.
      IF sy-subrc = 0.
      <lfs_output>-bismt = ls_mara-bismt.
      ENDIF.
    ENDLOOP.
ENDENHANCEMENT.

Leave a Reply