on 2023 Apr 26 9:38 PM
Hi team
I am trying to assign structure to field symbol. Here is my code.
Assign (RQDSES20_PDF)G_LSPROBEN-POSTAB[1]-PHYSPRTAB to field symbol <lfs_any>.
Here rqdses20_pdf is my program, G_lsproben is a structure, POSTAB[1] is a structure and PHYSPRTAB is a table .
Just Assign (RQDSES20_PDF)G_LSPROBEN-POSTAB is giving me value.
I can see (RQDSES20_PDF)G_LSPROBEN-POSTAB[1]-PHYSPRTAB having values while debugging. But how can I access this while writing code? Any help is appreciated.
Request clarification before answering.
The issue is about mentioning an index (e.g. [1]).
This statement:
Assign ('ITAB[1]') to field-symbol(<lfs_any>).
always returns sy-subrc = 4 and <lfs_any> remains unchanged in ABAP.
"ITAB[1]" works only within the ABAP debugger.
You must use:
DATA(itab) = VALUE string_table( ( `hello` ) ( `world` ) ).
FIELD-SYMBOLS <index_table> TYPE INDEX TABLE.
ASSIGN ('ITAB') TO <index_table>. " or ASSIGN itab TO <index_table>
ASSIGN <index_table>[1] TO FIELD-SYMBOL(<lfs_any>).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ciao Diana,
did you check out the blog The power of dynamism and data reference in SAP ABAP | SAP Blogs already?
Not sure what you mean with But how can I access this while writing code? . How did you define field-symbole <lfs_any>? Is it of type any?
Regards Andreas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
100 | |
8 | |
6 | |
5 | |
5 | |
5 | |
4 | |
3 | |
2 | |
2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.