2014 Dec 17 2:19 PM
Hello experts,
is it possible to point a table line to a variable?
I have an itab it_mara type mara with 10 entry´s.
If i type it_mara[1] in debugger the programm points perfectly to the structure of line 1.
If i type it_mara[2] in debugger the programm points perfectly to the structure of line 2.
This function i need in my code but:
assgin ('it_mara[1]') to <fs_mara> doesn´t work
Anyone an idea?
2014 Dec 17 2:32 PM
Hi
Why don't use READ statament?
ASSIGN ('IT_MARA[]') TO <FS_MARA_T>.
READ TABLE <FS_MARA_T> ASSIGNING <FS_MARA> INDEX 1.
Max
2014 Dec 17 2:45 PM
Yes assign line thru statements READ or equivalent with ASSIGNING option
/or/
Upgrade your SAP to a recent version
Regards,
Raymond
2014 Dec 17 3:13 PM
i can´t use read statement because in my application i build a path through a deep structure:
it_mara[1]-texts[2]-long
U know what i mean?
Yes i can capsule it, but i thought there is a easier way... The debugger can do this
2014 Dec 17 3:29 PM
The delights of scuba diving in the deep structures
The debugger can do this, but is everybody able and has time and opportunity to rewrite the debugger...
Regards,
Raymond
2014 Dec 17 3:38 PM
Hi
If you know the defination of source structure, you can define your field symbol like that:
TYPES: BEGIN OF TY_01,
FIELD1,
END OF TY_01.
TYPES: TTY_01 TYPE STANDARD TABLE OF TY_01.
*
DATA: BEGIN OF ITAB OCCURS 0,
FIELD,
FIELD_TAB TYPE TTY_01,
END OF ITAB.
DATA: WA TYPE TY_01.
*
FIELD-SYMBOLS: <FS_ITAB> TYPE TABLE.
FIELD-SYMBOLS: <FS_WA_ITAB> LIKE ITAB.
FIELD-SYMBOLS: <FS_WA> TYPE ANY.
DO 4 TIMES.
MOVE SY-INDEX TO ITAB-FIELD.
DO 6 TIMES.
MOVE SY-INDEX TO WA-FIELD1.
APPEND WA TO ITAB-FIELD_TAB.
ENDDO.
APPEND ITAB.
FREE ITAB-FIELD_TAB.
ENDDO.
ASSIGN ('ITAB[]') TO <FS_ITAB>.
READ TABLE <FS_ITAB> ASSIGNING <FS_WA_ITAB> INDEX 1.
READ TABLE <FS_WA_ITAB>-FIELD_TAB ASSIGNING <FS_WA> INDEX 2.
WRITE <FS_WA>.