Is there any way we can clear for loop structure fields in sap abap and return it back to new internal table.
LOOP AT lt_a INTO DATA(ls_a).
CLEAR: ls_a-f1, ls_a-f2.
APPEND ls_a TO lt_n.
ENDLOOP.
Can we achieve this scenario using FOR loop, Something like below?
lt_n = VALUE #( FOR <ls_a> IN LT_A ( f1 = '' f2 = '' ) ).
I need to send the complete structure <ls_a>
with clear fields f1
and f2
to lt_n
without mapping each field for <ls_a>
.
I think this will do it, if the field names are the same:
lt_n = VALUE #( FOR <ls_a> IN lt_a
( CORRESPONDING #( <ls_a>
MAPPING f1 = DEFAULT VALUE #( )
f2 = DEFAULT VALUE #( ) ) ).