Skip to Content
avatar image
Former Member

Acessing internal table inside another internal table

Hello guys

I'm starting to learn abap and have some doubts about internal tables access.

I have the following code:

TYPES:
t_column TYPE STANDARD TABLE OF string WITH EMPTY KEY,
t_row TYPE STANDARD TABLE OF t_column WITH EMPTY KEY.

DATA: columns TYPE i VALUE 3,
rows TYPE i VALUE 3.

DATA: it_column TYPE t_column,
it_row TYPE t_row.

DO rows TIMES.
CLEAR it_column.
DO columns TIMES.
APPEND sy-index TO it_column.
ENDDO.
APPEND it_column TO it_row.
ENDDO.

Basically I'm trying to simulate a matrix, using tables inside tables.

What I wanna do is to access specific data from it_column which is inside it_row. For example: I wanna set a value for Row 2, Column 2 (according to the code above it currently contains the value 2). Line 2 of it_row contains a table it_column containing 3 lines. This is the values I wanna access.

Is there anyway to loop into it_column from the second line of it_row?

Thanks in advance

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    avatar image
    Former Member
    Oct 20, 2016 at 05:59 PM

    Hi

    Yes, every record of table IT_ROW is a table too, so you can read the record of the first table and loop the records of the second one

    READ TABLE IT_ROW INTO IT_COLUMN INDEX 2.

    LOOP AT IT_COLUNM INTO .....

    ENDLOOP.

    Max

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 20, 2016 at 06:05 PM

    If you want to just loop at 2nd line, you can try.....

    loop at it_row into work_area from 2 to 2.

    endloop.

    If you want to loop from 2nd line till end of the table then

    loop at it_row into work_area from 2.

    endloop.

    -Chandra

    Add comment
    10|10000 characters needed characters exceeded