cancel
Showing results for 
Search instead for 
Did you mean: 

How to assign continuous structures to a field symbol?

Former Member
0 Kudos
263

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.

Accepted Solutions (0)

Answers (2)

Answers (2)

Sandra_Rossi
Active Contributor
0 Kudos

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>).
_4ndr3as_
Explorer
0 Kudos

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