Thursday, December 28, 2017

Table Comprehension Example Like Nested Loop

DATA lt TYPE TABLE OF i.
DO 10 TIMES.
APPEND sy-index TO lt.
ENDDO.
"loop at itab into wa. fill wa2 using wa and append lt2, all this using
DATA lt2 TYPE TABLE OF i.
lt2 = VALUE #( FOR lv IN lt ( lv * lv ) ).
"nested loop of lt and lt2 to create lines of lt3
DATA lt3 TYPE TABLE OF i.
lt3 = VALUE #( FOR lv IN lt FOR lv2 IN lt2 ( lv + lv2 ) ).
cl_demo_output=>display( lt3 ).


Virus-free. www.avast.com

No comments: