Professional Documents
Culture Documents
report zalv_grid_example.
tables:t001.
"Types
types:
begin of t_1001,
bukrs type t001-bukrs,
butxt type t001-butxt,
ort01 type t001-ort01,
land1 type t001-land1,
end of t_1001.
"Work area
data:
w_t001 type t_1001.
"Internal table
data:
i_t001 type standard table of t_1001.
*&---------------------------------------------------------------------*
* ALV Declarations
*----------------------------------------------------------------------*
* Types Pools
type-pools:
slis.
* Types
types:
t_fieldcat type slis_fieldcat_alv,
t_events type slis_alv_event,
t_layout type slis_layout_alv.
* Workareas
data:
w_fieldcat type t_fieldcat,
w_events type t_events,
w_layout type t_layout.
* Internal Tables
data:
i_fieldcat type standard table of t_fieldcat,
i_events type standard table of t_events.
*&---------------------------------------------------------------------*
*& start of selection
*&---------------------------------------------------------------------*
start-of-selection.
perform get_data.
*&---------------------------------------------------------------------*
*& end-of-selection.
*&---------------------------------------------------------------------*
end-of-selection.
perform build_fieldcatlog.
perform build_events.
perform build_layout.
perform list_display.
*&---------------------------------------------------------------------*
*& Form get_data
*&---------------------------------------------------------------------*
form get_data .
select bukrs
butxt
ort01
land1
from t001
into table i_t001
up to 30 rows.
endform. "BUILD_FIELDCATLOG
*&---------------------------------------------------------------------*
*& Form BUILD_FCATALOG
*&---------------------------------------------------------------------*
form build_fcatalog using l_field l_tab l_text.
w_fieldcat-fieldname = l_field.
w_fieldcat-tabname = l_tab.
w_fieldcat-seltext_m = l_text.
endform. "build_events
*&---------------------------------------------------------------------*
*& Form build_layout
*&---------------------------------------------------------------------*
form build_layout .
w_layout-colwidth_optimize = 'X'.
w_layout-zebra = 'X'.
w_header-typ = 'S'.
w_header-info = sy-title.
append w_header to li_header.
clear w_header.
w_header-typ = 'A'.
w_header-info = sy-uname.
append w_header to li_header.
clear w_header.