Code: Alles auswählen.
TRY.
cl_salv_table=>factory( IMPORTING r_salv_table = salv_table_object
CHANGING t_table = unsorted_copy_of_belegzeilen ).
CATCH cx_salv_msg INTO DATA(errormessage_object).
MESSAGE errormessage_object->get_text( ) TYPE 'I' DISPLAY LIKE 'E'.
ENDTRY.
salv_table_object->set_screen_status( report = sy-repid
pfstatus = SWITCH #( sy-sysid WHEN 'T01' THEN 'ERSTE_LISTE'
ELSE 'ERSTE_LISTE_NUR_UNAB' )
set_functions = cl_salv_model_base=>c_functions_all ).
* Zebra besteigen
display_object = salv_table_object->get_display_settings( ).
display_object->set_striped_pattern( cl_salv_display_settings=>true ).
* Spaltenüberschriften verbessern
columns_object = salv_table_object->get_columns( ).
columns_object->set_optimize( abap_true ).
TRY.
column_object ?= columns_object->get_column( 'AMPEL_BEREITS_ABGEGRENZT' ).
column_object->set_long_text( 'Beleg wurde bereits abgegrenzt' ). "max. 40 Zeichen
column_object->set_medium_text( 'bereits abgegrenzt' ). "max. 20 Zeichen
column_object->set_short_text( 'abgegrenzt' ).
CATCH cx_salv_not_found INTO DATA(salv_not_found_object).
MESSAGE salv_not_found_object->get_text( ) TYPE 'I' DISPLAY LIKE 'E'.
ENDTRY.
* Layout (Layoutänderungen benutzerweise abspeicherbar)
layout_object = salv_table_object->get_layout( ).
layout_object->set_key( VALUE #( report = sy-repid handle = '0001' ) ).
layout_object->set_save_restriction( cl_salv_layout=>restrict_user_dependant ).
* Events registrieren
event_object = salv_table_object->get_event( ).
CREATE OBJECT event_handler.
SET HANDLER: event_handler->on_user_command FOR event_object,
event_handler->on_double_click FOR event_object.
salv_table_object->display( ).
Code: Alles auswählen.
REPORT.
TYPES: BEGIN OF ty_table,
value1 TYPE dmbtr,
value2 type netwr,
END OF ty_table.
DATA l_table TYPE STANDARD TABLE OF ty_table.
l_table = VALUE #( ( value1 = '1232.12' value2 = '1232.12' ) ).
cl_salv_table=>factory(
IMPORTING
r_salv_table = DATA(l_salv)
CHANGING
t_table = l_table ).
l_salv->get_functions( )->set_all( abap_true ).
l_salv->display( ).
Folgende Benutzer bedankten sich beim Autor rob_abc für den Beitrag:
DeathAndPain