Application Development and Automation 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: 
Read only

Table structuree inside a Internal table

bharath_mohan2
Participant
0 Likes
499

Hi all,

I have an internal table declared with a table structure inside it. i have the declration as below


DATA: begin of itab1,
           field1,
           field2,
           end of itab1.

          begin of Itab2,
          field3
          itab type table of itab1
          end of itab2.

Now how will i access filed1 of Itab1 from itab2 ?? what is the syntax for it.

I tried itab2-itab1-field1 but it gives me a error.

Regards,

Bharath

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
481

Hi,

Instead of declaring a new table type and extending memory with the same records, you can do it this way also...

loop at itab2-itab into itab1.
  write itab1-field1.
  write itab1-field2.
endloop.

Regards,

Siddarth

3 REPLIES 3
Read only

Former Member
0 Likes
481

Hi,

DATA: begin of itab1,
           field1,
           field2,
           end of itab1.
 
          begin of Itab2,
          field3
          itab type table of itab1
          end of itab2.

DATA : itab3 type table of itab1.

" Declare the internal of type itab1and pass the itab2-itab data to itab3 and process itab3.
itab3[] = itab2-itab[]

LOOP AT ITAB3 INTO ITAB1.
WRITE:/ ITAB1-FIELD1.
ENDLOOP.

Read only

Former Member
0 Likes
482

Hi,

Instead of declaring a new table type and extending memory with the same records, you can do it this way also...

loop at itab2-itab into itab1.
  write itab1-field1.
  write itab1-field2.
endloop.

Regards,

Siddarth

Read only

0 Likes
481

Thanks Guys,

it was really useful, points awarded.