REPORT  Z_ALV_ORNEK .

DATA  BEGIN OF ialv OCCURS 0.
        INCLUDE STRUCTURE zmfatura.
DATA  END   OF ialv.

TYPE-POOLS: slis.
DATA: gt_fieldcat TYPE slis_t_fieldcat_alv.
DATA: g_repid LIKE sy-repid.


PERFORM select_data.
PERFORM fieldcat_init_01 USING gt_fieldcat[].
PERFORM show.

*---------------------------------------------------------------------*
*       FORM fieldcat_init_01                                         *
*---------------------------------------------------------------------*
FORM fieldcat_init_01
      USING rt_fieldcat TYPE slis_t_fieldcat_alv.

  DATA: ls_fieldcat TYPE slis_fieldcat_alv.
  DATA: pos TYPE i VALUE 1.

  CLEAR ls_fieldcat.
  pos = pos + 1.
  ls_fieldcat-col_pos       =  pos.
  ls_fieldcat-fieldname     = 'BUKRS'.
  ls_fieldcat-seltext_m     = ' Şirket Kodu '.
  APPEND ls_fieldcat TO  rt_fieldcat.

  CLEAR ls_fieldcat.
  pos = pos + 1.
  ls_fieldcat-col_pos       =  pos.
  ls_fieldcat-fieldname     = 'WERKS'.
  ls_fieldcat-seltext_m     = ' Personel Alanı  '.
  APPEND ls_fieldcat TO  rt_fieldcat.

  CLEAR ls_fieldcat.
  pos = pos + 1.
  ls_fieldcat-col_pos       =  pos.
  ls_fieldcat-fieldname     = 'BTRTL'.
  ls_fieldcat-seltext_m     = ' Personel Alt Alanı '.
  APPEND ls_fieldcat TO  rt_fieldcat.

  CLEAR ls_fieldcat.
  pos = pos + 1.
  ls_fieldcat-col_pos       =  pos.
  ls_fieldcat-currency      = 'TRL'.
  ls_fieldcat-outputlen     = 20.
  ls_fieldcat-fieldname     = 'M100'.
  ls_fieldcat-seltext_m     = ' Maas '.
  APPEND ls_fieldcat TO  rt_fieldcat.

ENDFORM.                    "fieldcat_init_01
*&---------------------------------------------------------------------*
*&      Form  SHOW
*&---------------------------------------------------------------------*
FORM show .

  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      i_callback_program = g_repid
      it_fieldcat        = gt_fieldcat[]
    TABLES
      t_outtab           = ialv.


ENDFORM.                    " SHOW
*&---------------------------------------------------------------------*
*&      Form  SELECT_DATA
*&---------------------------------------------------------------------*
FORM select_data .
  SELECT * FROM zmfatura INTO TABLE ialv.
ENDFORM.                    " SELECT_DATA



Serkan AKKAVAK
Bilgisayar Mühendisi
serkurumsal@yandex.com
SAP ve ABAP ile ilgili tüm sorularınızı gönderebilirsiniz.