11-22-2017 7:54 AM
Hey,
I want to append a structure into a table that is part of a structure. This structure is saved in another table I access via '[ key = key_value ]'. I know that this is not the most performant approach but does anyone know why this is not working?
The error is: "MT_GROUPED_CHANGES[" is not a field name
if line_exists( mt_grouped_changes[ receiver_name = receiver_name ] ).
append ls_change to mt_grouped_changes[ receiver_name = receiver_name ]-changes.
endif.
Best regards,
Max
11-22-2017 8:48 PM
In APPEND ... TO itab, itab is not meant to be a "functional operand position"; as nothing is specified in the ABAP documentation, it must just be an internal table:
If you look at READ TABLE itab, this is different, itab may be a "functional operand position":
(and for the question "why SAP did it like that", I don't know)
11-22-2017 9:42 AM
Can you try something like this?
I do not have system now so it may have some errors.
ASSIGN mt_grouped_changes[ receiver_name = receiver_name ] TO FIELD-SYMBOL(<lfs_mt>).
IF sy-subrc = 0.
APPEND ls_change TO <lfs_mt>-changes.
ENDIF.
11-22-2017 10:19 AM
Yes this works and I also found another suitable solution but I would like to know why my original solution is not working.
But thanks for the answer 🙂
11-22-2017 8:48 PM
In APPEND ... TO itab, itab is not meant to be a "functional operand position"; as nothing is specified in the ABAP documentation, it must just be an internal table:
If you look at READ TABLE itab, this is different, itab may be a "functional operand position":
(and for the question "why SAP did it like that", I don't know)
11-23-2017 9:11 AM