*&---------------------------------------------------------------------*
 *& Report ZLMN_DEN_001
 *&
 *&---------------------------------------------------------------------*
 *&
 *&
 *&---------------------------------------------------------------------*
REPORT ZLMN_DEN_001.
type-pools slis.
 TABLES mara.
data: fieldcat type slis_t_fieldcat_alv.
data: begin of lt_mara occurs 0,
 matnr type mara-matnr,
 ERNAM type mara-ERNAM,
 T_COLOR type slis_t_specialcol_alv,
 end of lt_mara.
data: ls_renk type slis_specialcol_alv,
 ls_sayi TYPE c.
start-of-selection.
perform veriler.
 perform rapor_yaz.
 **************************************************************
 " veriler
 **************************************************************
form veriler.
SELECT MATNR
 ERNAM
 from mara
 into CORRESPONDING FIELDS OF TABLE lt_mara.
 Loop at lt_mara.
 CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
 EXPORTING
 input = lt_mara-MATNR
 IMPORTING
 output = lt_mara-MATNR.
 modify lt_mara.
LS_SAYI = lt_mara-MATNR.
CASE LS_SAYI+0(1) .
 WHEN '1'.
 clear ls_renk.
 ls_renk-fieldname = 'MATNR'.
 ls_renk-color-col = '6'.
 ls_renk-color-int = '1'. "Intensified on/off
 ls_renk-color-inv = '0'.
 append ls_renk to lt_mara-T_COLOR.
 modify lt_mara.
 WHEN '2'.
 clear ls_renk.
 ls_renk-fieldname = 'MATNR'.
 ls_renk-color-col = '3'.
 ls_renk-color-int = '1'. "Intensified on/off
 ls_renk-color-inv = '0'.
 append ls_renk to lt_mara-T_COLOR.
 modify lt_mara.
 WHEN '3'.
 clear ls_renk.
 ls_renk-fieldname = 'MATNR'.
 ls_renk-color-col = '4'.
 ls_renk-color-int = '1'. "Intensified on/off
 ls_renk-color-inv = '0'.
 append ls_renk to lt_mara-T_COLOR.
 modify lt_mara.
 WHEN '4'.
 clear ls_renk.
 ls_renk-fieldname = 'MATNR'.
 ls_renk-color-col = '5'.
 ls_renk-color-int = '1'. "Intensified on/off
 ls_renk-color-inv = '0'.
 append ls_renk to lt_mara-T_COLOR.
 modify lt_mara.
 WHEN OTHERS.
 clear ls_renk.
 ls_renk-fieldname = 'MATNR'.
 ls_renk-color-col = '1'.
 ls_renk-color-int = '1'. "Intensified on/off
 ls_renk-color-inv = '0'.
 append ls_renk to lt_mara-T_COLOR.
 modify lt_mara.
ENDCASE.
endloop.
endform.
**************************************************************
 " rapor_yaz
 **************************************************************
 form rapor_yaz.
data: layout type slis_layout_alv.
layout-coltab_fieldname = 'T_COLOR'.
 perform build_field_catalog.
call function 'REUSE_ALV_GRID_DISPLAY'
 exporting
 is_layout = layout
 it_fieldcat = fieldcat
 tables
 t_outtab = lt_mara.
endform.
**************************************************************
 " BUILD_FIELD_CATALOG
 **************************************************************
 form build_field_catalog.
data: ls_gecici type slis_t_fieldcat_alv with header line.
 clear: fieldcat. refresh: fieldcat.
clear: ls_gecici.
 ls_gecici-reptext_ddic = 'Malzeme Numarası'.
 ls_gecici-fieldname = 'MATNR'.
 ls_gecici-tabname = 'lt_mara'.
 ls_gecici-outputlen = '25'.
 ls_gecici-col_pos = 2.
 append ls_gecici to fieldcat.
 clear: ls_gecici.
 ls_gecici-reptext_ddic = 'Oluşturan'.
 ls_gecici-fieldname = 'ERNAM'.
 ls_gecici-tabname = 'lt_mara'.
 ls_gecici-outputlen = '40'.
 ls_gecici-col_pos = 3.
 append ls_gecici to fieldcat.
endform.
 
***********************************************************
Serkan AKKAVAK
Bilgisayar Mühendisi
serkurumsal@yandex.com
SAP ve ABAP konusunda tüm sorun ve sorularınızı gönderebilirsiniz.