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

what is internal table? read the another questions

What are internal tables? How do you get the number of lines in an internal table? How to use a specific number occurs statement?

send me replay also

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

7 Answers

  • Posted on May 31, 2007 at 07:43 AM

    Hi

    An internal table is a temporary storage in the program memory which lasts only till the execution of the program. It can stored two dimensional data.

    There are no alternatives for internal tables and hence i don't see any disadvatages for Internal tables,(Even if internal tables have some limitations, i don;t think they can be disadvantages).

    http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb35de358411d1829f0000e829fbfe/content.htm>

    Regards,

    Sree

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 31, 2007 at 07:42 AM

    Hi

    Internal tables are run time tables used to data manipulations after fetching data into them from the SAT std tables

    Since it is not advised to play with the Std tables for all the SQL commands, we get data into them and we play with the Internal tables.

    they grow automatically along with the data

    Use DESCRIBE table ITAB lines v_lines

    gives the number of lines in internal tables

    Initially give OCCURS o for the declaration, then depending on the situation it automatically take the extra memory and size.

    Reward points if useful

    Regards

    Anji

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 31, 2007 at 07:55 AM

    hi,

    try this links....

    http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb35de358411d1829f0000e829fbfe/content.htm

    An internal table is one of two structured data types in ABAP. It can contain any number of identically structured rows, with or without a header line.

    The header line is similar to a structure and serves as the work area of the internal table. The data type of individual rows can be either elementary or structured.

    Internal tables provide a means of taking data from a fixed structure and storing it in working memory in ABAP. The data is stored line by line in memory, and each line has the same structure. In ABAP, internal tables fulfill the function of arrays. Since they are dynamic data objects, they save the programmer the task of dynamic memory management in his or her programs. You should use internal tables whenever you want to process a dataset with a fixed structure within a program. A particularly important use for internal tables is for storing and formatting data from a database table within a program. They are also a good way of including very complicated data structures in an ABAP program.

    Fields of Internal Tables

    SY-TABIX

    Current line of an internal table. SY-TABIX is set by the statements below, but only for index tables. The field is either not set or is set to 0 for hashed tables.

    APPEND sets SY-TABIX to the index of the last line of the table, that is, it contains the overall number of entries in the table.

    COLLECT sets SY-TABIX to the index of the existing or inserted line in the table. If the table has the type HASHED TABLE, SY-TABIX is set to 0.

    LOOP AT sets SY-TABIX to the index of the current line at the beginning of each loop lass. At the end of the loop, SY-TABIX is reset to the value that it had before entering the loop. It is set to 0 if the table has the type HASHED TABLE.

    READ TABLE sets SY-TABIX to the index of the table line read. If you use a binary search, and the system does not find a line, SY-TABIX contains the total number of lines, or one more than the total number of lines. SY-INDEX is undefined if a linear search fails to return an entry.

    SEARCH <itab> FOR sets SY-TABIX to the index of the table line in which the search string is found.

    SY-TFILL

    After the statements DESCRIBE TABLE, LOOP AT, and READ TABLE, SY-TFILL contains the number of lines in the relevant internal table.

    SY-TLENG

    After the statements DESCRIBE TABLE, LOOP AT, and READ TABLE, SY-TLENG contains the length of the lines in the relevant internal table.

    SY-TOCCU

    After the statements DESCRIBE TABLE, LOOP AT, and READ TABLE, SY-TLENG contains the initial amount of memory allocated to the relevant internal table.

    i think this will solve your problem don't forget to reward points.

    regards,

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 31, 2007 at 07:41 AM
    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on May 31, 2007 at 07:43 AM

    Internal table is local copy of database table, stored at application server.

    DESCRIBE TABLE itab LINES count.

    here count will get the number of entries.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 31, 2007 at 07:44 AM

    1) Internal tables are used to store several entries with the same structure. You can add or remove rows in this table.

    2) Use statement DESCRIBE TABLE internal_table LINES lines.

    lines is a variable of type i.

    3) Don't use OCCUR anymore. You should use declaration

    DATA: internal_table TYPE STANDARD TABLE OF structure.

    instead.

    Regards,

    Timo

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 31, 2007 at 08:26 AM

    <b>Internal table declaration

    Declaring internal tables is an essential part of writing ABAP code as this is where most of the data retrieved

    from database tables will be stored. During the select statement you retrieve data from a database table into

    an internal table (multiple rows) or a work area or header line (single row). </b>

     
    *&---------------------------------------------------------------------*
    *& Report  ZTYPES                                                      *
    *&                                                                     *
    *&---------------------------------------------------------------------*
    REPORT  ZTYPES                                                  .
    
    * Table declaration (old method)
    DATA: BEGIN OF tab_ekpo OCCURS 0,             "itab with header line
      ebeln TYPE ekpo-ebeln,
      ebelp TYPE ekpo-ebelp,
     END OF tab_ekpo.
    
    *Table declaration (new method)     "USE THIS WAY!!!
    TYPES: BEGIN OF t_ekpo,
      ebeln TYPE ekpo-ebeln,
      ebelp TYPE ekpo-ebelp,
     END OF t_ekpo.
    DATA: it_ekpo TYPE STANDARD TABLE OF t_ekpo INITIAL SIZE 0,      "itab
          wa_ekpo TYPE t_ekpo.                    "work area (header line)
    
    * Build internal table and work area from existing internal table
    DATA: it_datatab LIKE tab_ekpo OCCURS 0,      "old method
          wa_datatab LIKE LINE OF tab_ekpo.
    
    * Build internal table and work area from existing internal table,
    * adding additional fields
    TYPES: BEGIN OF t_repdata.
            INCLUDE STRUCTURE tab_ekpo.  "could include EKKO table itself!!
    TYPES: bukrs  TYPE ekpo-werks,
           bstyp  TYPE ekpo-bukrs.
    TYPES: END OF t_repdata.
    DATA: it_repdata TYPE STANDARD TABLE OF t_repdata INITIAL SIZE 0,   "itab
          wa_repdata TYPE t_repdata.                 "work area (header line)
    
     
    
    

    <b> sy-tabix </b> will give you the no of table entries in the table .... you can see the structure in the SE11 <b>syst</b> which has all the fields of the system ....

    reward points if it is usefull ...

    Girish

    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.