Reputation: 34081
I have the following code snippet, that I would like to write in functional style :
data(lt_es) = me->prepare_process_part_ztoa1( ).
APPEND LINES OF me->prepare_process_part_protocol( ) to lt_es.
How to rewrite the code above in new ABAP 7.5?
Upvotes: 1
Views: 11772
Reputation: 10524
It can be also done without BASE
. However one must specify the type explicitly (usage of #
ends with a syntax error).
REPORT ZZZ.
DATA: lt_t1 TYPE string_table,
lt_t2 TYPE string_table.
DATA(lt_t3) = VALUE string_table( ( LINES OF lt_t1 ) ( LINES OF lt_t2 ) ).
Would be interesting to know if this is maybe more performant than the usage of BASE
if used in a loop for example.
Upvotes: 2
Reputation: 5071
Use the LINES OF
construct (available since ABAP 7.40 SP 8).
For instance, it could be something like this:
lt_es = VALUE #( BASE me->prepare_process_part_ztoa1( )
( LINES OF me->prepare_process_part_protocol( ) ) ).
Whether it is better/simplier than the original, that's another question :)
Upvotes: 4