Skip to Content

header line and work area

Hi,

can anyone please explain me wht is the difference between header line and work area???

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

10 Answers

  • Posted on Jan 31, 2008 at 06:01 AM

    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,

    Nagaraj

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 31, 2008 at 06:02 AM

    Hi,

    Check this thread..

    Diff between header line and work area.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 31, 2008 at 06:03 AM

    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.

    Reward points if helpful...

    Regards,

    Goutham.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 31, 2008 at 06:03 AM

    Hi,

    INTERNAL TABLES

    - Internal tables are used to obtain data from a fixed structure for

    dynamic use in ABAP.

    - Each line in the internal table has the same field structure.

    - The main use for internal tables is for storing and formatting data from

    a database table within a program.

    WORK AREAS

    - Work areas are single rows of data.

    - It should have the same format as any of the internal tables.

    - It is used to process the data in an internal table one line at a time.

    Internal Tables with Header Line : Here the system automatically creates the work area. The work area has the same data type as internal table. This work area is called the HEADER line. It is here that all the changes or any of the action on the contents of the table are done. As a result of this, records can be directly inserted into the table or accessed from the internal table directly.

    Internal Tables without Header Line : Here there is no work area associated with the table. Work area is to be explicitly specified when we need to access such tables. Hence these tables cannot be accessed directly.

    HEADER LINE----

    CREATED EXPLICITLY------

    1.Internal table created by referring to another table

    Syntax: Data <f> <type> with header line.

    <type> refers to a table data type or table data objects using type or like.

    Here internal table <f> is created of the type <type>.

    Example:

    DATA t_line TYPE line OCCURS 10 with header line.

    2. Internal table created by referring to existing structure

    Syntax: Data<f> <type> occurs n with header line.

    The lines of the internal table <f> have the data type specified in <type> (Can use either like or type).

    Example:

    DATA flight_tab LIKE sflight OCCURS 10.

    CREATED BY DEFAULT---

    3. Internal table created With a new structure

    Syntax: Data : Begin of <f> occurs <n>,

    <component declaration>,

    ……………………………,

    End of <f>.

    Work area is created by default.

    Example:

    Data : Begin of itab occurs 10,

    column1 type I,

    column2(4) type C,

    column3 like mara-ernam,

    End of itab.

    reward if useful

    Regards

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 31, 2008 at 06:06 AM

    Hi,

    Both are same the tables when we r explicitly declaring the header line then we r transfering the records from the table to headerline i.e. then we call it as work area.

    PLzz reward points if it helps.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 31, 2008 at 06:07 AM

    Hi,

    Work area is a seperate definition which has the same structure as Internal table. Thus the data to be processed is passed to Work area from Internal table.

    Declaration:-

    types: begin of itab,

    .

    .

    end of tab.

    data: itab type standard table of itab.

    data: workarea type itab.

    Thus structure of internal table and work are are compatible.

    Header line works as Work Area when define in the structure of internal table. Data is passed to header line for processing this header line does not has any new name, its name is same as internal table, just when you use it the record of internal table is present in header line.

    Declaration:-

    data: begin of itab occurs 0,

    .

    .

    end of tab.

    or

    types: begin of itab,

    .

    .

    end of tab.

    data: itab type standard table of itab with header line.

    regards

    Vijai

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 31, 2008 at 06:08 AM

    HEADER LINE

    CREATED EXPLICITLY

    1.Internal table created by referring to another table

    Syntax: Data <f> <type> with header line.

    <type> refers to a table data type or table data objects using type or like.

    Here internal table <f> is created of the type <type>.

    Example:

    DATA t_line TYPE line OCCURS 10 with header line.

    2. Internal table created by referring to existing structure

    Syntax: Data<f> <type> occurs n with header line.

    The lines of the internal table <f> have the data type specified in <type> (Can use either like or type).

    Example:

    DATA flight_tab LIKE sflight OCCURS 10.

    CREATED BY DEFAULT---

    3. Internal table created With a new structure

    Syntax: Data : Begin of <f> occurs <n>,

    <component declaration>,

    ……………………………,

    End of <f>.

    Work area is created by default.

    Example:

    Data : Begin of itab occurs 10,

    column1 type I,

    column2(4) type C,

    column3 like mara-ernam,

    End of itab.

    reward if useful

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 31, 2008 at 06:12 AM

    hi,

    both have the same functionality the only difference is that.

    header line will have the same name as internal table.

    like if u declare an internal table itab with header line.

    itab will refer to its work area and itab[] wwill refer to table.

    but if u declare a internal table without header line and a separate work area for it,then itab will refer to the table.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 31, 2008 at 06:14 AM

    if we define the internal table with occurs 0 it will by default create with header line or if we define itab like standard table with occurs 0 then we won't get work area. then we have to define header line explicitly.

    work area is also similar to header line but we have to define explicitly. for standard table we can define in tables statement.

    or custom itab we have to define structure then we have to refer that strcutre for creation of internal table.then that itab won't have header line.

    we can print the data if it is ther in the header line or workare of the internal table.

    tables: kna1.

    • Internal table have Header line.

    data: begin of itab occurs 0,

    kunnr like kna1-kunnr,

    name1 like kna1-name1,

    end of itab.

    • Internal table without header line.

    • We can refer kna1 as workarea for itab1.

    data: itab1 like kna1 occurs 0.

    • Or

    data:itab2 like kna1 occurs 0 with header line.

    • Work area.

    data:

    Begin of fs_kna1,

    kunnr like kna1-kunnr,

    name1 like kna1-name1,

    end of fs_kna1.

    • Internal table declaration with out header line.

    data: i_kna1 like standard table of fs_kna1.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 31, 2008 at 06:16 AM

    see both are almost same ,

    Header line is created in a table at the time of its definition

    while

    Work area needs to be defined explicitly.

    Both are used for operations on a table.

    Append modify etc command work with header line only.

    Both contain only one record at a time.

    It is recommended that you have a explicitly defined work area.

    reward points if helpful,

    kushagra

    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.