SAP ABAP - Display ALV short way
Updated: Aug 29, 2022
SELECT * FROM mara INTO TABLE @DATA(lt_mara).
TRY.
cl_salv_table=>factory( IMPORTING r_salv_table = DATA(lo_alv)
CHANGING t_table = lt_mara ).
lo_alv->get_functions( )->set_all( ).
lo_alv->get_columns( )->set_optimize( ).
lo_alv->get_display_settings( )->set_striped_pattern( abap_true ).
lo_alv->display( ).
CATCH cx_root.
MESSAGE 'Error in ALV creation' TYPE 'E'.
ENDTRY.