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: 

Reg. comparison of two types of Internal tables.

Former Member
0 Kudos

Hi friends!

I have a doubt while declaring a internal table. whether to declare with header line or without header line. Can all types of manipulations be done after retrieving data from DB table to the Inernal table with headerline. Which of these two is more efficient. I would like to know the clear comparison between these two types.

regards,

prasad

5 REPLIES 5

Former Member
0 Kudos

Hi Prasad,

you should declare your internal table without header line. The header lines still work, but they are not allowed in the OO context. Even for more clearness in your programs it is better to use a separate work area instead of a header line. Also in case of maintenance and release changes (you might do an update to a release that will not allow header lines anymore) it is better to use a separate work area.

regards

Siggi

Former Member
0 Kudos

Hi Prasad,

Internal table with headerline will occupy more memory than the internal without header line. Thus to have a better memory management you can use internal without header line.

You can do all the manipulations on Tables without headerline as you do with headerlines. Even in the documentation all the internal table related manipulated are seperately provided for table with header line and table without header line. Actually, empty internal also occupy memory,so you need to think about the memory management also.

In efficiency Table without header lines are more efficient than the tables with Headerlines.

Check this link for the Manipulations on Internal tables...

http://help.sap.com/saphelp_47x200/helpdata/en/fc/eb36a1358411d1829f0000e829fbfe/content.htm

Regards,

Vara

Former Member
0 Kudos

Hi,

Incase of declaring an Internal table with header line will make the processing looks simple as with in a loop and endloop statement your internal manipulations namely AT NEW, AT LAST, COLLECT and other similar statements will work out, but still clearing of the respective header needs to be done whenever there is exit happens to the application after successful completion. As because I have encountered errors due to failure in clearing header as in case of batch applications and BDC applications. Also as mentioned memory management also needs to be considered.

Incase of declaring with work area except for the internal manipulations being pointed above, for all other cases it works out effectively and also more safer way to code your application.

Also the declaration with or without header line also accounts whenever there is a call to a function module at which if we require to receive or pass some data through TABLES option then we need to look for the specified table type being used.

So in all it depends the process in your application where in the type of declaration accounts.

Regards,

Jagath.

0 Kudos

The last time I have declared a table with header line was somewhen in 1999/2000 when we moved to a 46c System.

AT LAST, COLLECT etc does work also with internal tables without table lines. And if you pass it on as a tables parameter make sure to refer to its body by using the paranethesis.

call function....

tables

param = it_table_without_header_line[]

The mayor issue is the difference behaviour of the CLEAR statement.

CLEAR it_table_with_header_line will just clear the header

while

CLEAR it_table_without_header_line will clear the table contents.

Especially the different behaviour of this statement makes me to avoid those unintended deletes.

To make it short I do not see any reson to declare a table with header-line.

Christian

Former Member
0 Kudos

Hi,

Quite a detailed comparison has already been given for the two cases for internal tables. Just wanted to say that if you are looking for performance gains while processing internal tables, take a look at SAP Help for FIELD-SYMBOLS. They eliminate the need for copying internal table contents to and from work areas/header lines.

Regards