REPORT zalv_test.
TYPE-POOLS:slis .DATA: it_fieldcat TYPE slis_t_fieldcat_alv ,
wa_fieldcat TYPE slis_fieldcat_alv .
DATA: BEGIN OF itab OCCURS 0,
name(10) TYPE c,
marks TYPE i ,
pers type char5, "<---this should be character
grade TYPE char10,
END OF itab .
itab-name = 'venkat01'.
itab-marks = 4.
APPEND itab .
itab-name = 'venkat01'.
itab-marks = 15.
APPEND itab .
itab-name = 'venkat02'.
itab-marks = 21.
APPEND itab .
itab-name = 'venkat03'.
itab-marks = 18.
APPEND itab .
itab-name = 'venkat04'.
itab-marks = 9.
APPEND itab .
itab-name = 'venkat04'.
itab-marks = 24.
APPEND itab .
loop at itab .
itab-pers = ( itab-marks / 25 ) * 100 .
if itab-pers lt 35 .
itab-grade = 'bad'.
elseif itab-pers ge 35 and itab-pers lt 60 .
itab-grade = 'average '.
elseif itab-pers ge 60 and itab-pers lt 80 .
itab-grade = 'good'.
elseif itab-pers ge 80 and itab-pers lt 90 .
itab-grade = 'very good'.
elseif itab-pers ge 90 and itab-pers lt 100 .
itab-grade = 'best'.
endif.
concatenate itab-pers '%' into itab-pers.
modify itab.
endloop.
wa_fieldcat-fieldname = 'NAME'.
wa_fieldcat-seltext_m = 'name'.
append wa_fieldcat to it_fieldcat .
clear wa_fieldcat .
wa_fieldcat-fieldname = 'MARKS'.
wa_fieldcat-seltext_m = 'marks'.
append wa_fieldcat to it_fieldcat .
clear wa_fieldcat .
wa_fieldcat-fieldname = 'PERS'.
wa_fieldcat-seltext_m = 'percentage'.
append wa_fieldcat to it_fieldcat .
clear wa_fieldcat .
wa_fieldcat-fieldname = 'GRADE'.
wa_fieldcat-seltext_m = 'grade'.
append wa_fieldcat to it_fieldcat .
clear wa_fieldcat .
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = sy-repid
* IS_LAYOUT = IS_LAYOUT
it_fieldcat = it_fieldcat
TABLES
t_outtab = itab .
Serkan AKKAVAK
Computer Engineer
SAP Department Deputy Manager
Contact : serkurumsal@yandex.com
0 Comments