Hi,
If you are 100% sure, old_data and new_data are table. You can assign it to field-symbol then append lines of new_data to old_data.
field-symbols : <old_data> type table,
<new_data> type table.
assign old_data->* to <old_data>.
if sy-subrc eq 0.
assign new_data->* to <new_data>.
if sy-subrc eq 0.
append lines of <new_data> to <old_data>.
unassign : <new_data>,
<old_data>.
endif.
endif.
If you are not sure. you can check with cl_abap_typedescr class. But append part is same with above example.
data(l_type_old) = cl_abap_typedescr=>describe_by_data_ref( old_data ).
if l_type_old->type_kind EQ 'T'. " I'm not sure with T you can check with debbuger.
assign old_data->* to <old_data>.
data(l_type_new) = cl_abap_typedescr=>describe_by_data_ref( new_data ).
if l_type_new->type_kind EQ 'T'.
* Same as above example.
elseif l_type_new->type_kind EQ 'S'. " Again I'm not sure about S, you can check in debbuger.
* So new data is structure, you have to assign new_data to type any.
assign new_data->* to field-symbol(<new_data_wa>).
if sy-subrc eq 0.
append <new_data>
to <old_data>.
endif.
endif.
endif.
Regards
Tolga