report zlmn_yeni_prog.
 tables vbakvbkdekknvbapvbepekkoeketekpo.
 include zcreate_alv.
 start-of-selection.
   data g_variant type disvariant,
          lv_baslik type lvc_title value 'Başlık Deneme'.
   "Table tanımlama  GT_OUT tanımla   !!!!!!!!!!!!
   data begin of gt_out occurs 0,
             kunnr     like vbak-kunnr,
             bstkd     like vbkd-bstkd,
             vbeln     like ekkn-vbeln,
             vbelp     like ekkn-vbelp,
             kwmeng    like vbap-kwmeng,
             edatu     like vbep-edatu,
             lifnr     like ekko-lifnr,
             ebeln     like ekkn-ebeln,
             ebelp     like ekkn-ebelp,
             menge     like ekkn-menge,
             eindt     like eket-eindt,
             matnr     like ekpo-matnr,
             txz01     like ekpo-txz01,
          end of gt_out.
 ****************************************************
   perform get_data.
   perform build_layout . " use w_layout.
   perform build_fieldcatlog" use  LT_FIELDCAT.
   g_variant-report sy-repid.
   g_variant-handle 'ZZDD'.
   perform list_display tables gt_out
                        using lv_baslik
                              w_layout
                              lt_fieldcat
                              'USER_COMMAND' "CLICK olayı
                              g_variant
                              'MY_STATUS'"STATUS
 *****************************************************
 "ALV CLICK
 *&---------------------------------------------------------------------*
 *&      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'"
   endcase.
 endform.                    "user_command
 *&---------------------------------------------------------------------*
 *&      Form  MY_STATUS
 *&---------------------------------------------------------------------*
 *       text
 *----------------------------------------------------------------------*
 *      -->RT_EXTAB   text
 *----------------------------------------------------------------------*
 form my_status using rt_extab type slis_t_extab.
   set pf-status 'PF100' .
 endform.                    "MY_STATUS
 *&---------------------------------------------------------------------*
 *&      Form  GET_DATA
 *&---------------------------------------------------------------------*
 *       text
 *----------------------------------------------------------------------*
 *  -->  p1        text
 *  <--  p2        text
 *----------------------------------------------------------------------*
 form get_data .
   " SQL veri çekme
   select
           a~kunnr
           b~bstkd
           c~vbeln
           c~vbelp
           d~kwmeng
           e~edatu
           f~lifnr
           c~ebeln
           c~ebelp
           c~menge
           g~eindt
           h~matnr
           h~txz01
         from vbak as a
           inner join vbkd as b
           on a~vbeln b~vbeln
           inner join ekkn as c
           on a~vbeln c~vbeln
           inner join vbap as d
           on a~vbeln d~vbeln
           inner join vbep as e
           on a~vbeln e~vbeln
           inner join ekko as f
           on c~ebeln f~ebeln
           inner join eket as g
           on c~ebeln g~ebeln
           inner join ekpo as h
           on c~ebeln h~ebeln
       into table gt_out
       up to 10 rows.
 endform.                    " GET_DATA 



INCLUDE DOSYASI <zcreate_alv>
*&---------------------------------------------------------------------*
 *&  Include           ZCREATE_ALV
 *&---------------------------------------------------------------------*
 type-pools slis.
 data lt_fieldcat type slis_t_fieldcat_alv,
        w_layout    type slis_layout_alv.
 *&---------------------------------------------------------------------*
 *&      Form  BUILD_FIELDCATLOG
 *&---------------------------------------------------------------------*
 *       text
 *----------------------------------------------------------------------*
 *      -->P_LT_MARA  text
 *----------------------------------------------------------------------*
 form build_fieldcatlog .
   call function 'REUSE_ALV_FIELDCATALOG_MERGE'
     exporting
       i_program_name         sy-repid
       i_internal_tabname     'GT_OUT'
 *     I_STRUCTURE_NAME       =
       i_client_never_display 'X'
       i_inclname             sy-repid
 *     I_BYPASSING_BUFFER     =
 *     I_BUFFER_ACTIVE        =
     changing
       ct_fieldcat            lt_fieldcat
     exceptions
       inconsistent_interface 1
       program_error          2
       others                 3. 
 endform                   " BUILD_FIELDCATLOG
 *&---------------------------------------------------------------------*
 *&      Form  BUILD_LAYOUT
 *&---------------------------------------------------------------------*
 *       text
 *----------------------------------------------------------------------*
 *  -->  p1        text
 *  <--  p2        text
 *----------------------------------------------------------------------*
 form build_layout .
   w_layout-colwidth_optimize 'X'.
   w_layout-zebra             'X'.
 endform.                    " BUILD_LAYOUT
 *&---------------------------------------------------------------------*
 *&      Form  LIST_DISPLAY
 *&---------------------------------------------------------------------*
 *       text
 *----------------------------------------------------------------------*
 *      -->P_GT_OUT  text
 *      -->P_0055   text
 *      -->P_W_LAYOUT  text
 *      -->P_LT_FIELDCAT  text
 *      -->P_0058   text
 *      -->P_G_VARIANT  text
 *----------------------------------------------------------------------*
 form list_display  tables   t_out
 
                    using    u_title
                             u_layout
                             u_fieldcat
                             u_user
                             u_variant
                             u_status.
   if t_out[] is initial.
     message s499(sywith 'Veri Bulunamadı.' display like 'E'.
     stop.
   endif.
   data :  l_program type sy-repid.
   l_program sy-repid.
   call function 'REUSE_ALV_GRID_DISPLAY'
     exporting
       i_grid_title             u_title
       i_callback_program       l_program
       is_layout                u_layout
       it_fieldcat              u_fieldcat
 *     it_events                = i_events
       i_callback_pf_status_set u_status
       i_callback_user_command  u_user "'USER_COMMAND'
       i_save                   'A'
       i_default                'X'
       is_variant               u_variant
     tables
       t_outtab                 t_out[]
     exceptions
       program_error            1
       others                   2.
   if sy-subrc <> 0.
     message id sy-msgid type sy-msgty number sy-msgno
             with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
   endif.
 endform.                    " LIST_DISPLAY
 
 ***********************************************************
Serkan AKKAVAK
Bilgisayar Mühendisi
serkurumsal@yandex.com
SAP ve ABAP konusunda tüm sorun ve sorularınızı gönderebilirsiniz.