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

internal tables

plz send when do you need to create an internal table with header line ?and with out header line?

thank u

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

9 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jan 02, 2007 at 05:09 AM

    it is ur choice....based on requirement u can create it....Say, u have an internal table which needs to be used as a LOOP or READ then internal table needs to be created with header line...

    Now, u have just selected data and used to print, then internal table can be declared as without header line.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 02, 2007 at 05:31 AM

    Hi,

    Creating an internal table with header line reduces the code readability whereas the internal table without header line increase readability. And also internal table with header line is an old practice. Always it is recommended to use internal table without header line, usage of which needs the work area.

    -Satya Priya

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 02, 2007 at 06:15 AM

    HI

    1) When you create an internal table object you can also declare a header line with the same name.

    2) You can use the header line as a work area when you process the internal table. The ABAP statements that you use with internal tables have short forms that you can use if your internal table has a header line. These statements automatically assume the header line as an implicit work area.

    3) Using the header line as a work area means that you can use shorter statements; however, they are not necessarily easier to understand, since you cannot immediately recognize the origin and target of the assignment.

    4) Furthermore, the fact that the table and its header line have the same name can cause confusion in operations with entire internal tables. To avoid confusion, you should use internal tables with differently-named work areas.

    Regards,

    Gunasree.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 02, 2007 at 08:02 AM

    Hi,

    Please go through this link to know more about internal tables

    http://help.sap.com/saphelp_47x200/helpdata/en/fc/eb3660358411d1829f0000e829fbfe/frameset.htm

    Regards,

    Satyendra

    null

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 03, 2007 at 01:17 AM

    For the Internal Tables:

    1. Use it with separate Work area as if you use header line and you write its initial size to be 8. Now whenever you put some data in the header line once then it will reserve the memory for 8 records at that moment, whether or not you append that record in header line to the table.

    So there is a Memory wastage issue related with Implicit workarea or header line.

    2. It also create confusion in the code that you are uing header line or table for the new programer or reviewer of your Code.

    3. Also in the newer versions the tables with header line gives error in SLIN check for the program.

    Use Internal Table with header line in the following scenario:

    When you are sure about the number of records in the table then only you should go for the internal table with header line.

    Example for this is:

    BDC Recording. In the recording if you are having the table control and the minimum number of lines that can be displayed with different reolution are fixed say 3. Then you should go for header line with occurs 3. So that it makes the chunk of 3 and you can process the bdc table control with less efforts.

    I think so that this is answer for your question.

    Regards,

    Aman

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 03, 2007 at 03:35 AM

    Hi Prasad,

    Internal tables with header lines are not used now-a-days(Obsolete feature).SAP’s practice of maintaining strict downward compatibility prevents the total extinction of obsolete features from the language.Use internal tables without header lines for better compactibility.

    Regards,

    Balaji Reddy G

    **Rewards for helpful answers

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 03, 2007 at 04:44 AM

    Hi,

    You can create internal tables in many ways.

    1. First with header line:

    tables: <declaring the tables used>

    Data: begin of i_tab occurs 0,

    <fields> like <table name>-<fieldname>

    end of i_tab.

    2. Using the data elements

    Data: begin of i_tab occurs 0,

    <fields> type <data element>

    end of i_tab.

    3. Using the structures

    3.a.

    types: begin of struct,

    <fields> like <table name>-<fieldname>

    end of struct.

    3.b.

    types: begin of struct,

    <fields> type <data element>

    end of struct.

    in the both the cases above u have to declare the internal table

    data: i_tab type <table-type> of struct [<with header line>] .

    If you declare it with header line. At the time of data fetching. the select query can map all the fields and put the accurate data in the table.

    else you need to use the work area which is having the same structure as the internal table. It acts same as the header of the internal table.

    OPTIONS:

    If you are not using the work area at the time of data fetching then just use <into table> in your select query. the only thing u need to take care is to map the sequence of the fields. It should be same as the sequence of the structure defined above.

    DIFFERENCE BETWEEN LIKE AND TYPE:

    <b>Type</b> gives reference to the field of the table and copies at the attributes at runtime. And<b> like</b> copies all the attributes at the Compile time only.

    It decreases the size memory used.

    i think this will help u.

    Regards

    vamsi

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 03, 2007 at 05:30 AM

    Hi,

    WA:

    WA will read the database entries one by one.

    Benefit:

    Comparing is very easy.

    HL:

    HL read the database entries in one time.

    Disadvantages:

    Comparing is very difficult.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 10, 2007 at 12:10 PM

    internal tables with header lines are easy to work with but are not good for performance,you can use a work area with the same structure as the internal table.work areas have only one row similar to the internal table.

    with header line---

    loop at itab,

    <statements>

    endloop.

    without header line----

    loop at itab into wa(the work area).

    <statement>

    endloop.

    here the itab has no wa and it uses the wa defined by you in the data statement above.

    please reward points if of any use to you

    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.