Google Search - Blog...........

ABAP - Display ALV Report In Different Language

REPORT ZVENKATTEST.

tables:mara,makt.

TYPE-POOLS:SLIS.

data:begin of it_mara occurs 0,
matnr like mara-matnr,
meins like mara-meins,
mtart like mara-mtart,
end of it_mara.

data: begin of it_makt occurs 0,
matnr like mara-matnr,
maktx like makt-maktx,
SPRAS like makt-spras,
end of it_makt.

data:begin of it_final occurs 0,
matnr like mara-matnr,
meins like mara-meins,
mtart like mara-mtart,
maktx like makt-maktx,
end of it_final.

DATA:IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
IT_LAYOUT TYPE SLIS_LAYOUT_ALV.

select-options:s_matnr for mara-matnr.
parameters: p_lang like sy-langu.
parameters:p_rad1 radiobutton group g1 DEFAULT 'X',
p_rad2 radiobutton group g1,
p_rad3 radiobutton group g1.

AT SELECTION-SCREEN OUTPUT.

if p_rad1 = 'X'.
p_lang = 'EN'.
endif.

if p_rad2 = 'X'.
p_lang = 'DE'.
endif.

if p_rad3 = 'X'.
p_lang = 'FR'.
endif.

START-OF-SELECTION.

select matnr
meins
mtart
from mara
into table it_mara
where matnr in s_matnr.

select matnr
maktx
spras
from makt
into table it_makt
for all entries in it_mara
where matnr = it_mara-matnr
and spras = p_lang.

loop at it_mara.
it_final-matnr = it_mara-matnr.
it_final-meins = it_mara-meins.
it_final-mtart = it_mara-mtart.
read table it_makt with key matnr = it_mara-matnr.
it_final-maktx = it_makt-maktx.
append it_final.
clear it_final.
endloop.

WA_FIELDCAT-FIELDNAME = 'MATNR'.
WA_FIELDCAT-TABNAME = 'IT_FINAL'.
WA_FIELDCAT-REF_FIELDNAME = 'MATNR'.
WA_FIELDCAT-REF_TABNAME = 'MARA'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.

WA_FIELDCAT-FIELDNAME = 'MEINS'.
WA_FIELDCAT-TABNAME = 'IT_FINAL'.
WA_FIELDCAT-REF_FIELDNAME = 'MEINS'.
WA_FIELDCAT-REF_TABNAME = 'MARA'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.

WA_FIELDCAT-FIELDNAME = 'MTART'.
WA_FIELDCAT-TABNAME = 'IT_FINAL'.
WA_FIELDCAT-REF_FIELDNAME = 'MTART'.
WA_FIELDCAT-REF_TABNAME = 'MARA'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.

WA_FIELDCAT-FIELDNAME = 'MAKTX'.
WA_FIELDCAT-TABNAME = 'IT_FINAL'.
WA_FIELDCAT-REF_FIELDNAME = 'MATKX'.
WA_FIELDCAT-REF_TABNAME = 'MAKT'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
IS_LAYOUT = IT_LAYOUT
IT_FIELDCAT = IT_FIELDCAT
TABLES T_OUTTAB = IT_FINAL.


ALSO READ:

- ALV Pop Up To Select The Options & Display Them.

- Example On Blocking ALV List/Grid Display.

- Change The Layout Of The ALV List/Grid Display.

- Add Color In ALV List/Grid Display.

- Use Of Double Click On ALV Grid/List Display.

..... Back To Index On ALV List/ Grid Display.

..... Back To MAIN INDEX.

No comments:

Post a Comment