Bu program mara tablosundan matnr ve ernam alanlarını çekip yanlarına checkbox koyarak ekrana basar. Checkboxlardan seçim yapıp malzeme numarası sutununa çift tıklayınca sadece seçili olan kayıtlar ekrana gelecektir.
*&---------------------------------------------------------------------*
*& Report ZLMN_DEN_001
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ZLMN_DEN_001.
type-pools slis.
TABLES : mara , makt.
*START-OF-SELECTION.
*SET PF-STATUS 'TEST'.
END-OF-SELECTION.
data : fieldcat TYPE slis_t_fieldcat_alv WITH HEADER LINE,
fieldcat2 TYPE slis_t_fieldcat_alv WITH HEADER LINE.
data : my_repid type sy-repid.
data : begin of LT_MARA occurs 0,
MATNR type MARA-MATNR,
ERNAM type MARA-ERNAM,
FLAG,
end of LT_MARA.
data: LT_MARA2 LIKE table of LT_MARA WITH HEADER LINE.
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.
endform.
form veriler2.
Delete LT_MARA WHERE FLAG NE 'X'.
endform.
**************************************************************
" rapor_yaz
**************************************************************
form rapor_yaz.
data : layout type slis_layout_alv.
perform 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.
**************************************************************
" field_catalog
**************************************************************
form 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 = 'Seç'.
* fieldcat-INPUT = 'X'.
fieldcat-EDIT = 'X'.
fieldcat-checkbox = 'X'.
fieldcat-outputlen = '5'.
fieldcat-COL_POS = 1.
append fieldcat.
endform.
form field_catalog2.
refresh: fieldcat. clear: fieldcat.
fieldcat-reptext_ddic = 'Malzeme Numarası'.
fieldcat-fieldname = 'MATNR'.
fieldcat-tabname = 'LT_MARA'.
fieldcat-outputlen = '25'.
fieldcat-col_pos = 1.
append fieldcat.
endform.
FORM USER_COMMAND1 USING R_UCOMM LIKE SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.
my_repid = sy-repid.
RS_SELFIELD-refresh = 'X'.
CASE R_UCOMM.
WHEN '&IC1'.
if RS_SELFIELD-FIELDNAME = 'MATNR'.
PERFORM field_catalog2.
REFRESH fieldcat.
perform veriler2.
"clear lt_mara.
"perform RAPOR_YAZ2.
endif.
ENDCASE.
ENDFORM.
***********************************************************
Serkan AKKAVAK
Bilgisayar Mühendisi
serkurumsal@yandex.com
SAP ve ABAP konusunda tüm sorun ve sorularınızı gönderebilirsiniz.
Social Plugin