*&---------------------------------------------------------------------*
 *& Report ZLMN_DEN_001
 *&
 *&---------------------------------------------------------------------*
 *&
 *&
 *&---------------------------------------------------------------------*
REPORT ZLMN_DEN_001.
type-pools slis.
 TABLES mara.
data : fieldcat TYPE slis_t_fieldcat_alv WITH HEADER LINE.
 data: begin of lt_mara occurs 0,
 matnr type mara-matnr,
 ERNAM type mara-ERNAM,
 T_COLOR type slis_t_specialcol_alv,
 checkbox TYPE c,
 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 up to 20 ROWS.
 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'.
 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'.
 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'.
 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'.
 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'.
 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,
 gd_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[]
 i_grid_title = 'SONUÇLAR'
 I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
 tables
 t_outtab = lt_mara.
endform.
**************************************************************
 " BUILD_FIELD_CATALOG
 **************************************************************
 form build_field_catalog.
clear: fieldcat. refresh: fieldcat.
fieldcat-reptext_ddic = 'Malzeme Numarası'.
 fieldcat-fieldname = 'MATNR'.
 fieldcat-tabname = 'lt_mara'.
 fieldcat-outputlen = '25'.
 fieldcat-col_pos = 2.
 append fieldcat.
 fieldcat-reptext_ddic = 'OluÅŸturan'.
 fieldcat-fieldname = 'ERNAM'.
 fieldcat-tabname = 'lt_mara'.
 fieldcat-outputlen = '40'.
 fieldcat-col_pos = 3.
 append fieldcat.
fieldcat-FIELDNAME = 'FLAG'.
 fieldcat-SELTEXT_M = 'Onay'.
 * fieldcat-INPUT = 'X'.
 fieldcat-EDIT = 'X'.
 fieldcat-checkbox = 'X'.
 fieldcat-outputlen = '5'.
 fieldcat-COL_POS = 1.
 append fieldcat.
 endform.
FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
 RS_SELFIELD TYPE SLIS_SELFIELD.
 CASE R_UCOMM.
 WHEN '&IC1'. "
 ENDCASE.
 ENDFORM.
 
***********************************************************
Serkan AKKAVAK
Bilgisayar Mühendisi
serkurumsal@yandex.com
SAP ve ABAP konusunda tüm sorun ve sorularınızı gönderebilirsiniz.