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

doubt on internal table with headerline

Former Member
0 Likes
1,344

Hi all,

can any one explain which will be better performance wise,

internal table with headerline or without headerline

and why?

any useful suggestion will be rewarded.

Regards

cnu

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,308

at any point of time use internal table without header line,it will be good performance as well OO ABAP will allow only internal table without header line.

Just use one simple example :

create one simple program with header line,use get run time field.

create one simple program without header line,use get run time field.

see the results ,here time will be micro seconds,so take 1000 records to internal table and do calculate the time.

Thanks

Seshu

Hi all,

can any one explain which will be better performance wise,

internal table with headerline or without headerline

and why?

any useful suggestion will be rewarded.

Regards

cnu

11 REPLIES 11
Read only

Former Member
0 Likes
1,308

Hi,

I dont think there is any difference in performance in any of the case, but the extension with header line is not allowed in abap objects so it is adviced not to avoid using that.

Read only

0 Likes
1,308

Typo error , it is adviced to avoid using that..

Read only

Former Member
0 Likes
1,308

Hi,

Internal tables without header lines are better performance wise, then internal table with header lines. That is why, now a days its not recomended to use internal table with header line. But a seprate work area can be made to work around with header line.

hope this clears ur doubt..

Read only

Former Member
0 Likes
1,308

As for performance: use field symbols !!! This will greatly improve performance.

In general I'd discourage using itabs with header line as this is often ambigious such as in FORM myform TABLES ...

Besides, the outside world (such as java) doesn't know about itabs with header lines, so for future use in NetWeaver applications and the like this will cause headaches.

Read only

Former Member
0 Likes
1,308

HI

all ways declare internal table structure firt

like

types : begin of it_tab1,

f1(20),

f2(40),

f3(20),

end of it_tab1.

data : it_tab2 type it_tab1 occurs 1,

wa_tab2 type it_tab1,

in the performance way this is good to use

regards

naresh

Read only

Former Member
0 Likes
1,308

Any performance improvements by using header lines, work areas or field symbols is inconsequential. There are far bigger things to worry about first:




REPORT ztest MESSAGE-ID 00.

DATA: BEGIN OF itab_old OCCURS 0,
        f1,
      END   OF itab_old.

TYPES: BEGIN OF data_area,
        f1,
      END OF data_area.

DATA: itab_and_wa TYPE TABLE OF data_area WITH HEADER LINE,
      itab_only   TYPE TABLE OF data_area,
      wa_only     TYPE data_area.

FIELD-SYMBOLS: <fs> TYPE data_area.

DATA: start TYPE i,
      end   TYPE i,
      dif   TYPE i.

* Fill the internal tables
DO 50 TIMES.
  APPEND INITIAL LINE TO: itab_and_wa,
                          itab_only,
                          itab_old.
ENDDO.

* Take a number of readings
DO 5 TIMES.
* First check the performance of various internal tables
  GET RUN TIME FIELD start.
  LOOP AT itab_old.
  ENDLOOP.
  GET RUN TIME FIELD end.
  dif = end - start.
  WRITE: /001 'Time to loop internal table with OCCURS   :',
                   dif, 'microseconds'.

  GET RUN TIME FIELD start.
  LOOP AT itab_and_wa.
  ENDLOOP.
  GET RUN TIME FIELD end.
  dif = end - start.
  WRITE: /001 'Time to loop internal table with header   :',
                       dif, 'microseconds'.

  GET RUN TIME FIELD start.
  LOOP AT itab_only INTO wa_only.
  ENDLOOP.
  GET RUN TIME FIELD end.
  dif = end - start.
  WRITE: /001 'Time to loop internal table without header:',
                       dif, 'microseconds'.

  GET RUN TIME FIELD start.
  LOOP AT itab_only ASSIGNING <fs>.
  ENDLOOP.
  GET RUN TIME FIELD end.
  dif = end - start.
  WRITE: /001 'Time to loop internal table with ASSIGNING:',
                       dif, 'microseconds'.

* Check the performance of nested loops
  GET RUN TIME FIELD start.
  LOOP AT itab_old.
    LOOP AT itab_and_wa.
      LOOP AT itab_only INTO wa_only.
        LOOP AT itab_only ASSIGNING <fs>.
        ENDLOOP.
      ENDLOOP.
    ENDLOOP.
  ENDLOOP.
  GET RUN TIME FIELD end.
  dif = end - start.
  WRITE: /001 'Time for nested loop over four tables     :',
                       dif, 'microseconds'.
  SKIP.

ENDDO.

Rob

Message was edited by:

Rob Burbank

Read only

Former Member
0 Likes
1,309

at any point of time use internal table without header line,it will be good performance as well OO ABAP will allow only internal table without header line.

Just use one simple example :

create one simple program with header line,use get run time field.

create one simple program without header line,use get run time field.

see the results ,here time will be micro seconds,so take 1000 records to internal table and do calculate the time.

Thanks

Seshu

Read only

0 Likes
1,308

Seshu - that's exactly what the program I posted above does (except for the part about showing that internal tables without header lines are better for performance

Rob

Read only

0 Likes
1,308

Dear Rob,

I opened thread and gave the answer,my writting skills is very slow.

once i posted then i saw your post.

sorry for that.

Thanks

Seshu

Read only

0 Likes
1,308

I know what you mean - the forum is so sssllloooowwww lateley.

Rob

Read only

Former Member
0 Likes
1,308

Use internal without header line, if possible , use field symbols !

it will imporve your code performance .