2023 Jul 28 9:28 AM
Hello,
As i understand it Fieldsymbols are just pointing on columns or rows from Tables, but dont copy or save them.
Strucutes on the other hand are making copy of the Data and holding them, so they dont change the table directly like a field symbol.
Is this correct ?
2023 Jul 28 9:38 AM
No, it's not correct.
Fieldsymbols are just pointing on columns or rows from Tables
Wrong: Field symbols are references (like pointers) to any kind of data - the row of a table, an entire table, a structure, a field in a structure, at single field, an RTTS dynamically constructed data type...
but dont copy or save them
Neither wrong nor right. Copy or saving is irrelevant. If you change a field-symbol that's changing the data itrefers to.
Strucutes on the other hand are making copy of the Data and holding them, so they dont change the table directly like a field symbol.
Wrong. Structures are just structured data types. They contain fields and may be even internal tables.
From context I'm guessing you're talking about the difference between:
LOOP AT itab ASSIGNING FIELD-SYMBOL(<wa>).
and
LOOP AT itab INTO DATA(wa).
The former puts a reference of the current line of the internal table into the field symbol <wa>. Change <wa> and you are changing the record in itab.
The latter copys the data in the current line of the internal table into the structure (or possibly just a field) wa. If you change wa nothing happens to itab.
2023 Jul 28 9:35 AM
yes you are right.
In a nutshell field symbols are like a reference, so when you make a change there it directly changes the data in table. And structure is like a copy, so if you change there, if just changes data locally in that structure not in the table.
2023 Jul 28 9:37 AM
Hi michel1209,
Yes field-symbols points the data at run-time only and work area holds the data
Check
https://answers.sap.com/questions/4444137/use-of-field-symbols--work-area.html
Thanks
Tarun
2023 Jul 28 9:38 AM
No, it's not correct.
Fieldsymbols are just pointing on columns or rows from Tables
Wrong: Field symbols are references (like pointers) to any kind of data - the row of a table, an entire table, a structure, a field in a structure, at single field, an RTTS dynamically constructed data type...
but dont copy or save them
Neither wrong nor right. Copy or saving is irrelevant. If you change a field-symbol that's changing the data itrefers to.
Strucutes on the other hand are making copy of the Data and holding them, so they dont change the table directly like a field symbol.
Wrong. Structures are just structured data types. They contain fields and may be even internal tables.
From context I'm guessing you're talking about the difference between:
LOOP AT itab ASSIGNING FIELD-SYMBOL(<wa>).
and
LOOP AT itab INTO DATA(wa).
The former puts a reference of the current line of the internal table into the field symbol <wa>. Change <wa> and you are changing the record in itab.
The latter copys the data in the current line of the internal table into the structure (or possibly just a field) wa. If you change wa nothing happens to itab.
2023 Jul 28 9:46 AM
Yes exactly, i was talking about the lower example, thanks for your answer!