Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Acessing internal table inside another internal table

Former Member
0 Kudos

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

1 ACCEPTED SOLUTION

Former Member
0 Kudos

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

3 REPLIES 3

Former Member
0 Kudos

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

0 Kudos

Cool. I used modify table later in order to send it_column back to it_row. That worked, thanks!

former_member226239
Contributor
0 Kudos

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