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

Internal Tables

Former Member
0 Likes
837

Hi experts,

I'm very new to ABAP.

could u please clarify the following.

1.In how many ways can we declare an internal table (wa,body,header line,structure like...)?

2.How to choose suitable decleration?

Plz give one example for each type.

helpful answers will be rewarded.

Thanks & Regards.

Radhika.

1 ACCEPTED SOLUTION
Read only

former_member654348
Participant
0 Likes
811

Hi

You can define Internal tables in 2 ways

1. with header line

2. with out headerline

When u choose with headerline option, there is no need to create workarea, as it itself creates 1.

So u should be very careful in refreshing the internal table, because the name of the internal table and work area would be same, but the only differene is ,

u can refer internal table body as, 'itabname[]'

and header(work area) as ' itabname'.

coming to internal table without headerline,

u have to creatr workarea explicitly, as

1. like lint type of internal table

2. type structure type.

ex for internal table without header line:

*declaration of structure:

types: befin of ty_example,

v_no type i,

v_age type i,

end of ty_example.

*declaration of internal table:

data: i_example type standard table of ty_example.

*declaration of work area:

data: wa_example like line of i_example (or)

data: wa_example type ty_example.

It is a good practice to use internal table without headerline.

7 REPLIES 7
Read only

Former Member
0 Likes
811

hi,

Welcome to SDN ...

Check out the below related threads .. Hope it helps .

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
811

U can also make a search in forums or google

Read only

Former Member
0 Likes
811

Hi .

There are 2 ways by which u can declare internal table,

with header line / without header line.

1.with header line

Data : itab like <table-name> occurs 0 with header line.

2. without header line

Data : itab type table of <table-name>

data : wa like line of itab.

if u want to go with Sap standards then choose 2nd option but sometimes it will become lengthy so we take internal table with header lines.

Read only

former_member265047
Active Participant
0 Likes
811

Hi Radhika,

Welcome to SAP world. You can check the below SAP help link, you can get complete information about internal tables, how many types, how to declare and how to process etc.....

http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb35de358411d1829f0000e829fbfe/frameset.htm

Regards,

Naveen Veshala

Read only

Former Member
0 Likes
811

Hi,

1.In how many ways can we declare an internal table (wa,body,header line,structure like...)?

A : Please search in SDN forum.

2.How to choose suitable decleration?

A : Please search in SDN forum.

Thanks,

Sriram Ponna.

Read only

Former Member
0 Likes
811

hi

By using the Data statement

-1 By referring to another table

- 2 By referring to a structure

- 3 With a new structure

In the (1 and 2) first two cases Header line is optional. In the third (3) case Header line is created by default.

1. Example:

DATA t_line TYPE line OCCURS 10 with header line.

2 Example:

DATA flight_tab LIKE sflight OCCURS 10.

3 Syntax

Data : Begin of <f> occurs <n>,

<component declaration>,

u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026,

End of <f>.

Work area (Header) is created by default.

Amit

Read only

former_member654348
Participant
0 Likes
812

Hi

You can define Internal tables in 2 ways

1. with header line

2. with out headerline

When u choose with headerline option, there is no need to create workarea, as it itself creates 1.

So u should be very careful in refreshing the internal table, because the name of the internal table and work area would be same, but the only differene is ,

u can refer internal table body as, 'itabname[]'

and header(work area) as ' itabname'.

coming to internal table without headerline,

u have to creatr workarea explicitly, as

1. like lint type of internal table

2. type structure type.

ex for internal table without header line:

*declaration of structure:

types: befin of ty_example,

v_no type i,

v_age type i,

end of ty_example.

*declaration of internal table:

data: i_example type standard table of ty_example.

*declaration of work area:

data: wa_example like line of i_example (or)

data: wa_example type ty_example.

It is a good practice to use internal table without headerline.