Skip to Content
author's profile photo Former Member
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 a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on 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 a comment
    10|10000 characters needed characters exceeded

  • Posted on 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 a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.