Code: Alles auswählen.
REPORT.
CLASS Report DEFINITION.
PUBLIC SECTION.
TYPES:
BEGIN OF ty_data,
vbeln TYPE vbeln,
description TYPE c LENGTH 50,
END OF ty_data,
tty_data TYPE STANDARD TABLE OF ty_data WITH EMPTY KEY.
CLASS-METHODS:
main.
PRIVATE SECTION.
CLASS-METHODS:
createRawData,
correspondingBeforeLoop,
correspondingInsideLoop,
correspondingInsideFor,
outputData.
CLASS-DATA:
raw TYPE tty_data.
ENDCLASS.
CLASS Report IMPLEMENTATION.
METHOD main.
createRawData( ).
correspondingBeforeLoop( ).
correspondingInsideLoop( ).
correspondingInsideFor( ).
outputData( ).
ENDMETHOD.
METHOD createRawData.
raw = VALUE #(
( vbeln = '1' description = 'Lorem ipsum dolor sit amet' )
( vbeln = '2' description = 'Fusce aliquet purus quis porttitor varius' )
( vbeln = '3' description = 'Sed molestie lacus orci' )
( vbeln = '4' description = 'Proin maximus sagittis tortor' ) ).
ENDMETHOD.
METHOD correspondingBeforeLoop.
DATA(output) = CORRESPONDING tty_data( raw ).
LOOP AT output ASSIGNING FIELD-SYMBOL(<row>).
<row>-vbeln = |{ <row>-vbeln ALPHA = IN }|.
ENDLOOP.
cl_demo_output=>write(
name = 'correspondingBeforeLoop'
data = output ).
ENDMETHOD.
METHOD correspondingInsideLoop.
DATA(output) = VALUE tty_data( ).
LOOP AT raw ASSIGNING FIELD-SYMBOL(<row>).
INSERT VALUE #( BASE
CORRESPONDING #( <row> )
vbeln = |{ <row>-vbeln ALPHA = IN }| ) INTO TABLE output.
ENDLOOP.
cl_demo_output=>write(
name = 'correspondingInsideLoop'
data = output ).
ENDMETHOD.
METHOD correspondingInsideFor.
DATA(output) = VALUE tty_data( FOR x IN raw ( VALUE #( BASE
CORRESPONDING #( x )
vbeln = |{ x-vbeln ALPHA = IN }| ) ) ).
cl_demo_output=>write(
name = 'correspondingInsideFor'
data = output ).
ENDMETHOD.
METHOD outputData.
cl_demo_output=>display( ).
ENDMETHOD.
ENDCLASS.
START-OF-SELECTION.
Report=>main( ).
Code: Alles auswählen.
DATA(output) = CORRESPONDING tty_data( raw ).
LOOP AT output ASSIGNING FIELD-SYMBOL(<row>).
<row>-vbeln = |{ <row>-vbeln ALPHA = IN }|.
ENDLOOP.
Code: Alles auswählen.
DATA(output) = VALUE tty_data( FOR <row> IN CORRESPONDING #( raw ) ( vbeln = |{ <row>-vbeln ALPHA = IN }| ) ).
Das ist doch aber in seinem Beispielcode
Code: Alles auswählen.
DATA(output) = VALUE tty_data( FOR x IN raw ( VALUE #( BASE
CORRESPONDING #( x )
vbeln = |{ x-vbeln ALPHA = IN }| ) ) ).