DATA: BEGIN OF line,
CUOBJ TYPE CUOBJ,
tab_atinn TYPE STANDARD TABLE OF ATINN WITH DEFAULT KEY,
END OF line.
DATA:
CUBOBJ_TABLE LIKE STANDARD TABLE OF line WITH DEFAULT KEY.
...
DATA(table) = CUBOBJ_TABLE[ CUOBJ = value-instance ]-tab_atinn.
IF NOT line_exists( table[ currentatinn ] ).
INSERT currentatinn INTO table INDEX 1.
ENDIF.
I'm trying to add a new row into CUOBJ_TABLE [..]-tab_atinn. The table variable will have a new row after executing the code but the CUBOBJ_TABLE[ CUOBJ = value-instance ]-tab_atinn table won't have it.
How can I add it directly into CUBOBJ_TABLE[ CUOBJ = value-instance ]-tab_atinn using a reference or something?
With a reference exactly, the issue is the assignment:
This creates a new table with the sames values as the tab_atinn field. Then you add the entry to this new table without affecting the deep table in CUOBJ_TABLE. What you need is a reference pointing to the table you want to change so it actually updates the table and not a copy of it, something like the code below should work.