filmov
tv
Tutorial 10 - Adding additional fields in standard report MB52 in SAP
Показать описание
How to add additional fields in MB52 standard report of SAP using enhancement.
OR You can use same way to add fields in the SAP standard report of SAP. But you have to find the output function to add the data .
Helping code is given below.
"Add fields extra fields here in the bestand structure . makt-maktg field
Data MAKTG type MAKTG.
"--------------------
"--- Now get data in the bestand internal table.
DATA:
WA_FIELDCAT LIKE LINE OF FIELDCAT,
G_TABIX LIKE SY-TABIX.
data wa_BESTAND like LINE OF BESTAND.
"-----Add column in structure-----
WA_FIELDCAT-FIELDNAME = 'MAKTG'.
WA_FIELDCAT-TABNAME = 'BESTAND'.
wa_fieldcat-seltext_m = 'Description2'.
wa_fieldcat-col_pos = 36.
APPEND WA_FIELDCAT TO FIELDCAT.
clear WA_FIELDCAT.
LOOP AT BESTAND INTO wa_BESTAND.
G_TABIX = SY-TABIX.
clear wa_bestand-maktg.
SELECT SINGLE MAKTG FROM MAKT INTO wa_bestand-maktg WHERE
MATNR EQ wa_bestand-MATNR AND SPRAS EQ 'E'.
MODIFY BESTAND FROM wa_BESTAND INDEX G_TABIX TRANSPORTING MAKTG.
CLEAR: wa_BESTAND, G_TABIX.
ENDLOOP.
OR You can use same way to add fields in the SAP standard report of SAP. But you have to find the output function to add the data .
Helping code is given below.
"Add fields extra fields here in the bestand structure . makt-maktg field
Data MAKTG type MAKTG.
"--------------------
"--- Now get data in the bestand internal table.
DATA:
WA_FIELDCAT LIKE LINE OF FIELDCAT,
G_TABIX LIKE SY-TABIX.
data wa_BESTAND like LINE OF BESTAND.
"-----Add column in structure-----
WA_FIELDCAT-FIELDNAME = 'MAKTG'.
WA_FIELDCAT-TABNAME = 'BESTAND'.
wa_fieldcat-seltext_m = 'Description2'.
wa_fieldcat-col_pos = 36.
APPEND WA_FIELDCAT TO FIELDCAT.
clear WA_FIELDCAT.
LOOP AT BESTAND INTO wa_BESTAND.
G_TABIX = SY-TABIX.
clear wa_bestand-maktg.
SELECT SINGLE MAKTG FROM MAKT INTO wa_bestand-maktg WHERE
MATNR EQ wa_bestand-MATNR AND SPRAS EQ 'E'.
MODIFY BESTAND FROM wa_BESTAND INDEX G_TABIX TRANSPORTING MAKTG.
CLEAR: wa_BESTAND, G_TABIX.
ENDLOOP.
Комментарии