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

Creating Internal table or work area

Former Member
0 Likes
525

Hi

I have struct1 LIKE TABLE OF struct2.

both are structures. can anybody give me syntax to create the internal table for this and how to store values from struct1 to the internal table/

thanks in advance

kp

3 REPLIES 3
Read only

amit_khare
Active Contributor
0 Likes
449

you may use -

data: begin of i_tab.

include structure struct1.

data: end of i_tab.

data: wa_tab type struct1.

this will create an internal table without header line and you can use structure to pass value to it.

As an alternative you may also use -

data: begin of i_tab occurs 0.

include structure struct1.

data: end of i_tab.

this will create an internal table with header line but this is not advisable.

Regards,

Amit

Reward all helpful replies.

Read only

Former Member
0 Likes
449

Hi,

IF you have struct1 LIKE TABLE OF struct2.

Then STRUCT1 is an internal table..

Exa.

DATA: ITAB LIKE TABLE OF STRUCT1.

DATA: WA LIKE STRUCT1.

WA-FIELD1 = 'ABC'.

WA-FIELD2 = 10.

  • Populate the internal table ITAB from the work area WA

APPEND WA TO ITAB.

  • display the records.

LOOP AT ITAB INTO WA.

WRITE: / WA-FIELD1, WA-FIELD2.

ENDLOOP.

Thanks,

Naren

Read only

Former Member
0 Likes
449

You can declare a Internal table using the structure

Data: ITAB_struct1 like struct2 OCCURS 0 WITH HEADER LINE.

ITAB_struct1 = 'abcd'.

append ITAB_struct1.

clear ITAB_struct1.

You can declare the internal table without the headerline also. In that case you don't have to have the clear ITAB_struct1 statement.

Uma.