Abap
Abap
---------------------------------------------------------------
*manuell mit Feldsymbolen (~30% langsamer als die beiden vorherigen Varianten)
LOOP AT itab1 ASSIGNING FIELD-SYMBOL(<wa_1>).
APPEND INITIAL LINE TO itab2 ASSIGNING FIELD-SYMBOL(<wa_2>).
MOVE-CORRESPONDING <wa_1> TO <wa_2>.
ENDLOOP.
* copy end---------------------------------------------------------------
*example 2:
TYPES: BEGIN OF aggregated_data_type,
group TYPE group,
count TYPE i,
sum TYPE i,
min TYPE i,
max TYPE i,
average TYPE f,
END OF aggregated_data_type,
aggregated_data TYPE STANDARD TABLE OF aggregated_data_type WITH EMPTY KEY.
* Loops ---------------------------------------------------------------
** easy loop
loop at initial_numbers REFERENCE into data(initial_number).
write initial_number->number .
endloop.
* for example 1
TYPES: BEGIN OF alphatab_type,
cola TYPE string,
colb TYPE string,
colc TYPE string,
END OF alphatab_type.
TYPES alphas TYPE STANDARD TABLE OF alphatab_type.
"or
combined_data = value #( for i = 1 while i < lines( alphas ) + 1
(
colx = alphas[ i ]-cola && VALUE string( nums[ i ]-col1 optional )
coly = alphas[ i ]-colb && VALUE string( nums[ i ]-col2 optional )
colz = alphas[ i ]-colc && VALUE string( nums[ i ]-col3 optional )
)
).
*end for
-----------------------------------------------------------------------------------
*demo*
b*demo*