Code: Alles auswählen.
TABLES: bkpf, bseg.
*Selection-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE title_01.
SELECTION-SCREEN BEGIN OF BLOCK block1 WITH FRAME TITLE title_01.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 5(15) p_name1 FOR FIELD p_blart.
PARAMETERS: p_blart TYPE blart.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK block1.
AT SELECTION-SCREEN OUTPUT.
p_name1 = 'Belegart'.
INITIALIZATION.
p_blart = 'DD'. "Set default value
END-OF-SELECTION.
Data:
BEGIN OF lt_bkpf OCCURS 0,
bukrs LIKE bkpf-bukrs,
blart LIKE bkpf-blart,
gjahr LIKE bkpf-gjahr,
END OF lt_bkpf.
SELECT
bukrs,
blart,
gjahr
FROM bkpf
WHERE @bkpf-blart LIKE @p_blart
INTO CORRESPONDING FIELDS OF @lt_bkpf.
ENDSELECT.
DATA: go_functions TYPE REF TO cl_salv_functions. "Symbolleiste
DATA: go_table TYPE REF TO cl_salv_table. "Klasse
DATA: go_display TYPE REF TO cl_salv_display_settings. "Displayeinstellungen
DATA: go_columns TYPE REF TO cl_salv_columns_table. "Spaltenmanipulation
DATA: go_column TYPE REF TO cl_salv_column_table.
DATA: color TYPE lvc_s_colo. "Farbe
DATA: go_sorts TYPE REF TO cl_salv_sorts. "Sortierung
DATA: go_agg TYPE REF TO cl_salv_aggregations. "Aggregation
DATA: go_filter TYPE REF TO cl_salv_filters. "Filter
DATA: go_layout TYPE REF TO cl_salv_layout. "Layout
DATA: key TYPE salv_s_layout_key.
cl_salv_table=>factory( IMPORTING r_salv_table = go_table
CHANGING t_table = lt_bkpf ).
* Symbolleiste wird eingeblendet
go_functions = go_table->get_functions( ).
go_functions->set_all( abap_true ).
go_display = go_table->get_display_settings( ).
go_display->set_striped_pattern( cl_salv_display_settings=>true ).
go_display->set_list_header( 'Belegzuordnung' ).
go_columns = go_table->get_columns( ).
go_column ?= go_columns->get_column( 'CITYTO' ).
* Überschriftenbezeichnung ändern
go_column->set_long_text( 'Lange Überschrifte' ). "max. 40 Zeichen
go_column->set_medium_text( 'Mittlere Überschrift' ). "max. 20 Zeichen
go_column->set_short_text( 'Überschr.' ). "max. 10 Zeichen
* Sortierung
go_sorts = go_table->get_sorts( ).
"gr_sorts->add_sort( 'CITYTO' ).
* Filter
go_filter = go_table->get_filters( ).
go_filter->add_filter( columnname = 'CARRID' low = 'LH' ).
* Layout (Layoutänderungen abspeicherbar)
go_layout = go_table->get_layout( ).
key-report = sy-repid.
go_layout->set_key( key ).
go_layout->set_save_restriction( cl_salv_layout=>restrict_none ).
*******************
* Anzeige Tabelle *
*******************
go_table->display( ).
Code: Alles auswählen.
lt_bkpf[]
Code: Alles auswählen.
TYPES: begin of ts_bkpf,
field1 type something,
...
end of ts_bkpf,
tt_bkpf TYPE STANDARD TABLE OF wa.
DATA gt_bkpf TYPE tt_bkpf.