Code: Alles auswählen.
REPORT.
CLASS lcl_report DEFINITION.
PUBLIC SECTION.
TYPES:
BEGIN OF ty_text,
text TYPE c LENGTH 100,
END OF ty_text,
tty_texts TYPE STANDARD TABLE OF ty_text WITH NON-UNIQUE KEY table_line.
CLASS-METHODS main.
PRIVATE SECTION.
CLASS-DATA:
source_for TYPE tty_texts,
source_base TYPE tty_texts,
source_append TYPE tty_texts,
source_insert TYPE tty_texts,
source_select TYPE tty_texts.
CLASS-METHODS prepare_source_table.
CLASS-METHODS fill_table_with_base.
CLASS-METHODS fill_table_with_append.
CLASS-METHODS fill_table_with_insert.
CLASS-METHODS fill_table_with_for.
CLASS-METHODS fill_table_with_select.
ENDCLASS.
CLASS lcl_report IMPLEMENTATION.
METHOD main.
prepare_source_table( ).
fill_table_with_select( ).
fill_table_with_for( ).
fill_table_with_insert( ).
fill_table_with_append( ).
fill_table_with_base( ).
ENDMETHOD.
METHOD prepare_source_table.
DO 999999 TIMES.
INSERT VALUE #( text = |Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam a sodales lorem. { sy-index }: for| ) INTO TABLE source_for.
INSERT VALUE #( text = |Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam a sodales lorem. { sy-index }: base| ) INTO TABLE source_base.
INSERT VALUE #( text = |Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam a sodales lorem. { sy-index }: append| ) INTO TABLE source_append.
INSERT VALUE #( text = |Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam a sodales lorem. { sy-index }: insert| ) INTO TABLE source_insert.
INSERT VALUE #( text = |Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam a sodales lorem. { sy-index }: select| ) INTO TABLE source_select.
ENDDO.
ENDMETHOD.
METHOD fill_table_with_base.
DATA rng_texts TYPE RANGE OF ty_text.
LOOP AT source_base ASSIGNING FIELD-SYMBOL(<row>).
rng_texts = VALUE #( BASE rng_texts ( sign = 'I' option = 'EQ' low = <row>-text ) ).
ENDLOOP.
ENDMETHOD.
METHOD fill_table_with_append.
DATA rng_texts TYPE RANGE OF ty_text.
LOOP AT source_append ASSIGNING FIELD-SYMBOL(<row>).
APPEND VALUE #( sign = 'I' option = 'EQ' low = CONV #( <row>-text ) ) TO rng_texts.
ENDLOOP.
ENDMETHOD.
METHOD fill_table_with_insert.
DATA rng_texts TYPE RANGE OF ty_text.
LOOP AT source_insert ASSIGNING FIELD-SYMBOL(<row>).
INSERT VALUE #( sign = 'I' option = 'EQ' low = CONV #( <row>-text ) ) INTO TABLE rng_texts.
ENDLOOP.
ENDMETHOD.
METHOD fill_table_with_for.
DATA rng_texts TYPE RANGE OF ty_text.
rng_texts = VALUE #( FOR <row> IN source_for ( sign = 'I' option = 'EQ' low = <row>-text ) ).
ENDMETHOD.
METHOD fill_table_with_select.
DATA rng_texts TYPE RANGE OF ty_text.
SELECT DISTINCT 'I' AS sign,
'EQ' AS option,
source~text AS low
FROM @source_select AS source
INTO CORRESPONDING FIELDS OF TABLE @rng_texts.
ENDMETHOD.
ENDCLASS.
START-OF-SELECTION.
lcl_report=>main( ).