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

Performance

Former Member
0 Likes
685

Internal tables with header and without header line. Which is performance wise best? Why?

Insert and append which is performce wise best? Why?

How will be the performance if i use the corresponding addition?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
622

internal tables without header line is good performance becuase whenever u read record from the table it copies the record into the header line which is time consuming so it is not used generally.

inserting is not good performance because it inserts at particular location in internal table so its time consuming ...while append directly adds the record at the end of the internal tbale,

in corresponding addition it will take more time for inserting the fields because system checks the fields first and then inserts the data.

reward points if useful.....

5 REPLIES 5
Read only

Former Member
0 Likes
622

Use internal tables without header

example :

TYPES : BEGIN OF tp_itab1,

bukrs TYPE ekko-bukrs,

lifnr TYPE ekko-lifnr,

ebeln TYPE ekko-ebeln,

waers TYPE ekko-waers,

bsart TYPE ekko-bsart,

ekorg TYPE ekko-ekorg,

ekgrp TYPE ekko-ekgrp,

ebelp TYPE ekpo-ebelp,

txz01 TYPE ekpo-txz01,

matnr TYPE ekpo-matnr,

werks TYPE ekpo-werks,

menge TYPE ekpo-menge,

meins TYPE ekpo-meins,

netpr TYPE ekpo-netpr,

netwr TYPE ekpo-netwr,

name1 TYPE t001w-name1,

header_text(132),

chk TYPE c,

END OF tp_itab1.

DATA : t_itab1 TYPE STANDARD TABLE OF tp_itab1,

wa_itab1 TYPE tp_itab1.

To refer any field in the above you should refer t_itab1-fieldname

but when you are looping you have to mention in the below way.

LOOP AT t_itab1 INTO <b>wa_itab1.</b>

Here wa_itab1 is work area.

<b>Corresponding</b> is not good performance wise. if there is no choice or only some fileds needs to be updated go for corresponding else give the internal table in the same order as the other table, so that you dont require corresponding.

Read only

Former Member
0 Likes
622

hi

internal table with out header line is best beacuse u dont specify the size of the internal table here (means no need use occurs specification) ,u can get it thru workarea concept.

ex:

types: begin of itab,

vbeln type vbak-vbeln,

end of itab.

data: itab1 type table of itab ,

wa type itab.

now operations can be performed on internal table through work area only.

if u go for with header line

ex: data: begin of itab occurs 0,

vbeln type vbak-vbeln,

end of vbeln.

but performance wise with out header is good.

insert and append , i think we should not consider performance because append adds the record at end and insert in required place wherever u want.

we should not go for the corresponding option because it has to find the corresponding fields of the table it is performance issue.

regards

sandhya

Read only

Former Member
0 Likes
623

internal tables without header line is good performance becuase whenever u read record from the table it copies the record into the header line which is time consuming so it is not used generally.

inserting is not good performance because it inserts at particular location in internal table so its time consuming ...while append directly adds the record at the end of the internal tbale,

in corresponding addition it will take more time for inserting the fields because system checks the fields first and then inserts the data.

reward points if useful.....

Read only

Former Member
0 Likes
622

hi,

1.Internal tables without header line is the best

bcz if you use without header line you should have to declare that itab with types stmt for which system does not allocate memory.

2.both Insert and Append stmts are good with respect to the performance.

3.if you use corresponding addition performance will be down.

coz, system will search for the fields and data types of the perticular fields which you mentioned after the corresponding addition. here system will put extra effort.

thats why this is not good.

<b>Reward points if useful</b>

Chandra

Read only

seshatalpasai_madala
Product and Topic Expert
Product and Topic Expert
0 Likes
622

Hi,

It depends upon the <b>kind of Internal</b> table also.

Performance wise both Internal table with Headerline and with out header line are the same, the only difference is For a table with headerline the first record acts as a workarea and for a table with out header line you need to create your own. So if you do any operation like read you have to copy the data.

<b>You should not use tables with header line only for the reason</b> that they create confusion in the program's readability. For example if there is a statement

CLEAR: itab you will not know if it is clearing the header line or the table until you know the kind of table.

Both INSERT and APPEND behave in a same manner if you dont mention the INDEX.

If you mention the INDEX then APPEND performance is better. Also For a SORTED internal table INSERT and APPEND can take more time as it involves resorting the table.

Regards,

Sesh