Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

'Is not a field name' error when appending to a nested table

Former Member

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

1 ACCEPTED SOLUTION

Sandra_Rossi
Active Contributor

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)

4 REPLIES 4

kostas_tsioubris
Contributor

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.

0 Kudos

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 🙂

Sandra_Rossi
Active Contributor

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)

0 Kudos

Ah ok I see. Thanks!