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: 

Internal table & Work area

Former Member
0 Kudos
2,773

Hi Experts,

I am a novice to ABAP. Can anyone tell me whats the difference b/w internal table and work area. In writing function modules how these will be utilized and in what way.

Regards

ss

1 ACCEPTED SOLUTION

Former Member
0 Kudos
2,311

HI,

Internal table can store data.

data itab like mara occurs 0 with header line.

storage space is allocated to internal table

data itab1 like mara .

above statement behaves like workarea .

loop at itab into itab1(work area).

write:/itab1.

endloop.

Regards

Amole

7 REPLIES 7

Former Member
0 Kudos
2,311

Hi satish,

Work area means it is nothing but a stucture.

For example if a table has 3 colomns. workarea of that table can store 1 record and table can store more records.

Normally any record is inserted into table through work area only. first one record goes to work area ,and then that record is stored into internal table.again same workarea is used to store another record and it is send to internal table.

Thanks,

Suma

Former Member
0 Kudos
2,311

Hi,

While adding or retrieving records to / from internal table we have to keep the record temporarily.

The area where this record is kept is called as work area for the internal table. The area must have the same structure as that of internal table. An internal table consists of a body and an optional header line.

Header line is a implicit work area for the internal table. It depends on how the internal table is declared that the itab will have the header line or not.

e.g.

data: begin of itab occurs 10,

ab type c,

cd type i,

end of itab. " this table will have the header line.

data: wa_itab like itab. " explicit work area for itab

data: itab1 like itab occurs 10. " table is without header line.

The header line is a field string with the same structure as a row of the body, but it can only hold a single row.

It is a buffer used to hold each record before it is added or each record as it is retrieved from the internal table. It is the default work area for the internal table.

Regards,

vind.

Former Member
0 Kudos
2,311

Hello,

INTERNAL Table and it's background:

===================================

Internal table acts as a container which is used to store the record sets. That is used to store the data fetched from the database table.

So due to performance reason every time access to database would not be so good and decrease the performance. So you just select the data from the database and store it in the intermediate table. This table is called INTERNAL TABLE. So it's an replica of the database. The design foes like this,

PRESENTATION SERVER <> APPLICATION SERVER <>

DATABASE SERVER.

So everytime gain accessing to database results in high resource usage and bad permformance.

So always play around with internal tables. So obviously the whenever you access the data in the INTERNAL TABLE, the application server will be used.

WORK AREA:

==========

When ever you loop at the internal table, the current record should be stored in a temporary work place. That is called WORK AREA.

LOOP AT ITAB INTO WORKAREA.

ENDLOOP.

ITAB :An internal table

WORKAREA:An instance of internal table

I hope this help.

Regs,

Venkat Ramanan N

Former Member
0 Kudos
2,311

HI,

Internal tables are a standard data type object which exists only during the runtime of the program. They are used to perform table calculations on subsets of database tables and for re-organising the contents of database tables according to users need.

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

Difference between Work Area and Header Line

While adding or retrieving records to / from internal table we have to keep the record temporarily.

The area where this record is kept is called as work area for the internal table. The area must have the same structure as that of internal table. An internal table consists of a body and an optional header line.

Header line is a implicit work area for the internal table. It depends on how the internal table is declared that the itab will have the header line or not.

e.g.

data: begin of itab occurs 10,

ab type c,

cd type i,

end of itab. " this table will have the header line.

data: wa_itab like itab. " explicit work area for itab

data: itab1 like itab occurs 10. " table is without header line.

The header line is a field string with the same structure as a row of the body, but it can only hold a single row.

It is a buffer used to hold each record before it is added or each record as it is retrieved from the internal table. It is the default work area for the internal table

1) The difference between

whih header line and with out heater line of internal table.

ex:-

a) Data : itab like mara occurs 0 with header line.

b) Data: itab like mara occurs 0.

-While adding or retrieving records to / from internal table we have to keep the record temporarily.

-The area where this record is kept is called as work area for the internal table.

-The area must have the same structure as that of internal table. An internal table consists of a body and an optional header line.

-Header line is a implicit work area for the internal table. It depends on how the internal table is declared that the itab will have the header line or not.

a) Data : itab like mara occurs 0 with header line.

table is with header line

b) Data: itab like mara occurs 0.

table is without header line

2)work area / field string and internal table

which one is prefarable for good performance any why ?

-The header line is a field string with the same structure as a row of the body, but it can only hold a single row , whereas internal table can have more than one record.

In short u can define a workarea of an internal table which means that area must have the same structure as that of internal table and can have one record only.

Example code:

data: begin of itab occurs 10,

ab type c,

cd type i,

end of itab. " this table will have the header line.

data: wa_itab like itab. " explicit work area for itab

data: itab1 like itab occurs 10. " table is without header line.

http://www.allsaplinks.com/faq_abap_internaltables.html

Do reward if it helps,

Regards,

Laxmi

Former Member
0 Kudos
2,312

HI,

Internal table can store data.

data itab like mara occurs 0 with header line.

storage space is allocated to internal table

data itab1 like mara .

above statement behaves like workarea .

loop at itab into itab1(work area).

write:/itab1.

endloop.

Regards

Amole

0 Kudos
2,311

Great guys,

I almost understood, but can you explain these in the function module concept. It would be very helpful.

Points Rewarded.

Regards

ss

0 Kudos
2,311

Hi,

Go thru the link below

Regards

Sajeed