Skip to Content
author's profile photo Former Member
Former Member

headerline

hi experts,

what is the heder line for internaltable, how can it aloocate memory when using with headerline. some body says while using witout header line we can get more forformence with compare with header line please explain me with exaples,

with regards

radhakrishna

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Sep 20, 2007 at 04:38 AM

    Hi Reddy,

    If you specify WITH HEADER LINE, the table is created with a header line,

    that is, a field with the same name. It has the same type as the line

    type of the table.

    For the sake of clarity, the table name should identify the table

    uniquely, or then it depends on the statement whether the body or header

    line of a table is accessed (header or table?).

    Without header lines programs are easier to read. Table data and

    structure are separated.

    Tables with header lines do not improve performance and only tables

    without header lines can be declared in ABAP Objects.

    So it's better to use the syntax:

    DATA: itab TYPE|LIKE TABLE OF ... ,

    wa LIKE LINE OF itab.

    Example:

    DATA: BEGIN OF line,

    col1(1) TYPE c,

    col2(1) TYPE c,

    END OF line.

    DATA: with_header_tab LIKE TABLE OF line WITH HEADER LINE,

    without_header_tab LIKE TABLE OF line.

    line-col1 = 'A'. line-col2 = 'B'.

    APPEND line TO with_header_tab.

    • with header line, SAP creates de work area

    LOOP AT with_header_tab.

    WRITE: / with_header_tab-col1, with_header_tab-col2.

    ENDLOOP.

    MOVE with_header_tab[] TO without_header_tab.

    • without header line, you create de work area and use into

    LOOP AT without_header_tab INTO line.

    WRITE: / line-col1, line-col2.

    ENDLOOP.

    Thanks,

    Reward If Helpful.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 20, 2007 at 04:39 AM

    In with header line, the header is the workarea that is the internal table is having implicit workarea whereas in without header line, the internal table has a explicit workarea.

    When u can create internal tables with header line, even empty internal tables will occupy 256 bytes memory. Whereas if u create internal tables without header line, it will just occupy 16 bytes for each records u store which says u the performance.

    There will not be any performance issue if u are storing a smaller number of records. But when u are storing larger number of records like 2 lakh entries, there comes the [performance issue.

    Please reward if helpful.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 20, 2007 at 04:54 AM

    hi,,

    header line is the concept used for tables with header line. whenever you want to enter dat into the internal body first it should be passed to header line using SELECT STATEMENT and from there using APPEND it is passed to body of internal table.

    for any operations that is to be performed on data of internal table like MODIFY, UPDATE, LOOP for then the data first should be passed from body to header line and we ll modify data in header itself and again place it body......

    ex:

    select * from mara INTO TABLE ITAB where matnr in p_matnr.

    LOOP AT ITAB.

    WRITE:/10 ITAB-.......

    ENDLOOP.

    internal tables without header line use the concept of workarea. workarea is some thing similar to header but it is not attached to internal table. here we have to explicitly pass data from workarea to body of internal table and some thing for modification.

    ex:

    populate data from mara into internal table without header line itab as

    wa ls the workarea [header of itab]

    then

    select * from mara INTO wa where matnr in p_matnr.

    APPEND ITAB FROM WA.

    endselect.

    for processing

    LOOP AT ITAB INTO WA. [itab INTO wa -


    used for any operation in internal table without header line

    WRITE:/10 WA-.......

    WA-.........

    ENDLOOP.

    ADV:

    1.a table without header line can be nested into another table which is not possible for tables with header line.

    2. provides more flexibility then tables with header line as we can create a workarea of our wish and use for our table.

    if helpful reward some points.

    with regards,

    Suresh Aluri.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.