Simple ALV Grid

Simple ALV Grid display using CL_SALV_TABLE, is shown below. GT_OUTPUT_TABLE is an internal table whose structure is from data dictionary.

data: lo_alv type ref to cl_salv_table,
lo_cols_tab type ref to cl_salv_columns_table,
lo_selections type ref to cl_salv_selections,
lo_layout  type ref to cl_salv_layout,
ls_key    type salv_s_layout_key,
lx_msg type ref to cx_salv_msg.

try.
cl_salv_table=>factory(
importing
r_salv_table = lo_alv
changing
t_table = gt_su_head ).

catch cx_salv_msg into lx_msg.
endtry.

lo_alv->set_screen_status(
pfstatus = ‘STANDARD_FULLSCREEN’
report   = ‘SAPLSLVC_FULLSCREEN’
set_functions = lo_alv->c_functions_all ).

lo_cols_tab = lo_alv->get_columns( ).
lo_cols_tab->set_optimize(‘X’).

lo_selections = lo_alv->get_selections( ).
lo_selections->set_selection_mode( if_salv_c_selection_mode=>row_column ).

lo_layout = lo_alv->get_layout( ).
ls_key-report = sy-repid.
lo_layout->set_key( ls_key ).
lo_layout->set_save_restriction( if_salv_c_layout=>restrict_none ).

lo_alv->display( ).

Leave a comment