report ZMM_DEPO_LISTESI
 type-pools slis.
 tables :  mara,mard,makt.
 
 data  fieldcat  type  slis_t_fieldcat_alv with header line,
         fieldcat2 type  slis_t_fieldcat_alv with header line,
         secilen   type  string,
         layout    TYPE  slis_layout_alv,
         toplam    TYPE  mard-labst.
 
 databegin of lt_mara occurs 0,
          matnr     type mara-matnr,
          ernam     type mara-ernam,
          werks     type mard-werks,
          toplam    type mard-labst,
       end of lt_mara.
 
 databegin of lt_mara2 occurs 0,
         matnr     type mara-matnr,
         maktx     type makt-maktx,
       end of lt_mara2.
 
 
 start-of-selection.
 
   perform veriler.
   perform rapor_yaz.
 
 
 **************************************************************
   "   veriler
 **************************************************************
 form veriler.
   select
         a~matnr
         a~ernam
         b~werks
         sumb~labst as toplam
 
         from mara as a
         inner join mard as on b~matnr a~matnr
         into table lt_mara
         up to 34 rows
         group by a~matnr a~ernam b~werks
         order by a~matnr.
         
 LOOP AT lt_mara.
 
 ENDLOOP.        
         
 endform.                    "VERILER
 
 **************************************************************
 "  rapor_yaz
 **************************************************************
 form rapor_yaz.
   layout-zebra    'X'.
   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'
       i_callback_program      sy-repid
     tables
       t_outtab                lt_mara.
 endform.                    "RAPOR_YAZ
 
 
 *&---------------------------------------------------------------------*
 *&      Form  RAPOR_DETAY
 *&---------------------------------------------------------------------*
 *       text
 *----------------------------------------------------------------------*
 form rapor_detay.
 
   select
       matnr
       maktx
       from makt
        into corresponding fields of table lt_mara2 where matnr secilen.
 
   perform build_field_catalog2.
 
   call function 'REUSE_ALV_GRID_DISPLAY'
     exporting
       it_fieldcat  fieldcat2[]
       i_grid_title 'DETAYLAR'
     tables
       t_outtab     lt_mara2.
 endform.                    "RAPOR_DETAY
 
 
 **************************************************************
 " BUILD_FIELD_CATALOG
 **************************************************************
 
 form build_field_catalog.
 
   clearfieldcat.  refreshfieldcat.
 
   fieldcat-reptext_ddic   'Malzeme Numarası'.
   fieldcat-fieldname      'MATNR'.
   fieldcat-tabname        'lt_mara'.
   fieldcat-outputlen      '25'.
   fieldcat-col_pos        2.
   append fieldcat.
 
 
   fieldcat-reptext_ddic   'DeÄŸiÅŸtiren'.
   fieldcat-fieldname      'ERNAM'.
   fieldcat-tabname        'lt_mara'.
   fieldcat-outputlen      '25'.
   fieldcat-col_pos        3.
   append fieldcat.
 
 
   fieldcat-reptext_ddic   'Ãœretim Yeri'.
   fieldcat-fieldname      'WERKS'.
   fieldcat-tabname        'lt_mara'.
   fieldcat-outputlen      '15'.
   fieldcat-col_pos        3.
   append fieldcat.
 
   fieldcat-reptext_ddic   'Toplam Miktar'.
   fieldcat-fieldname      'TOPLAM'.
   fieldcat-tabname        'lt_mara'.
   fieldcat-outputlen      '15'.
   fieldcat-col_pos        3.
   append fieldcat.
 
 endform.                    "BUILD_FIELD_CATALOG
 
 *&---------------------------------------------------------------------*
 *&      Form  BUILD_FIELD_CATALOG2
 *&---------------------------------------------------------------------*
 *       text
 *----------------------------------------------------------------------*
 form build_field_catalog2.
 
   clearfieldcat2.  refreshfieldcat2.
 
   fieldcat2-reptext_ddic   'Malzeme Numarası'.
   fieldcat2-fieldname      'MATNR'.
   fieldcat2-tabname        'lt_mara2'.
   fieldcat2-outputlen      '25'.
   fieldcat2-col_pos        1.
   append fieldcat2.
 
   fieldcat2-reptext_ddic   'Açıklaması'.
   fieldcat2-fieldname      'MAKTX'.
   fieldcat2-tabname        'lt_mara2'.
   fieldcat2-outputlen      '25'.
   fieldcat2-col_pos        2.
   append fieldcat2.
 
 endform                   "BUILD_FIELD_CATALOG2
 
 
 
 *&---------------------------------------------------------------------*
 *&      Form  USER_COMMAND
 *&---------------------------------------------------------------------*
 *       text
 *----------------------------------------------------------------------*
 *      -->R_UCOMM      text
 *      -->RS_SELFIELD  text
 *----------------------------------------------------------------------*
 form user_command using r_ucomm like sy-ucomm               "#EC CALLED
 rs_selfield type slis_selfield.
 
   case r_ucomm.
     when '&IC1'.
       if rs_selfield-fieldname 'MATNR'.
         secilen rs_selfield-value.
         perform rapor_detay.
         "REFRESH: fieldcat.
       endif.
   endcase.
 endform.                    "USER_COMMAND
 
 
 
 
Serkan AKKAVAK
Bilgisayar Mühendisi
serkurumsal@yandex.com