*&---------------------------------------------------------------------*
 *& Report ZLMN_DEN_001
 *&
 *&---------------------------------------------------------------------*
 *&
 *&
 *&---------------------------------------------------------------------*
REPORT ZLMN_DEN_001.
type-pools slis.
 TABLES mara.
START-OF-SELECTION.
SET PF-STATUS 'TEST'.
END-OF-SELECTION.
 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,
 FLAG,
 end of lt_mara.
 data: begin of lt_mara2 occurs 0,
 matnr type mara-matnr,
 ERNAM type mara-ERNAM,
 end of lt_mara2.
 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.
 endloop.
endform.
**************************************************************
 " rapor_yaz
 **************************************************************
form rapor_yaz.
data: layout type slis_layout_alv.
 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_COMMAND1'
 I_CALLBACK_PROGRAM = sy-REPID
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-TABNAME = 'LT_MARA'.
 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_COMMAND1 USING R_UCOMM LIKE SY-UCOMM "#EC CALLED
 RS_SELFIELD TYPE SLIS_SELFIELD.
 CASE R_UCOMM.
 WHEN '&IC1'. "
 BREAK-POINT.
 LOOP AT lt_mara WHERE FLAG = 'X'.
 lt_mara2-MATNR = lt_mara-MATNR.
 APPEND lt_mara2.
 ENDLOOP.
ENDCASE.
ENDFORM.
 
 
 ***********************************************************
Serkan AKKAVAK
Bilgisayar Mühendisi
serkurumsal@yandex.com
SAP ve ABAP konusunda tüm sorun ve sorularınızı gönderebilirsiniz.