SAP ABAP - Add Custom Field In MB52
1. Add custom field declaration in structure bestand
Custom field can be added directly with Insert line area or using enhancement point
2. Add New Enhancement Point in list_ouput sub routines
ENHANCEMENT 1 ZMB52_ADDITIONALFIELD. "active version
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""$"$\SE:(134) Form LIST_OUTPUT, Start, Enhancement ZMB52_ADDITIONALFIELD, Start A
data: wa_fcat LIKE LINE OF fieldcat,
g_tabix LIKE sy-tabix.
CLEAR wa_fcat.
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.
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.
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""$"$\SE:(135) Form LIST_OUTPUT, Start, Enhancement ZMB52_ADDITIONALFIELD, End A
ENDENHANCEMENT.
Comments
Post a Comment