Differences between standard structured sorted hashed internal tables.

can any one elobrate the differences among them with simple examples.
why hashed table serch is faster...what happens if list is not sorted...explain the scenarios best suitable ..when we go for what kinda tables...

<a href="http://www.sap-img.com/abap/what-are-different-types-of-internal-tables-and-their-usage.htm">refer this link for details</a>
<a href="http://www.geekinterview.com/question_details/1498">also refer this</a>
<a href="http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb366d358411d1829f0000e829fbfe/content.htm">also this- SAP Help</a>
regards,
srinivas

Similar Messages

  • Difference between the Field Group  and Internal Table.

    Hi all,
    Can anybody tell me the difference between the Field group and Internal table and when they will used?
    Thanks,
    Sriram.

    Hi
    Internal Tables: They are used to store record type data in tabular form temporarily in ABAP programming. Or we can say, it stores multiple lines of records for temporary use in ABAP programming.
    A field group is a user-defined grouping of characteristics and basic key figures from the EC-EIS or EC-BP field catalog.
    Use
    The field catalog contains the fields that are used in the aspects. As the number of fields grows, the field catalog becomes very large and unclear. To simplify maintenance of the aspects, you can group fields in a field group. You can group the fields as you wish, for example, by subject area or responsibility area. A field may be included in several field groups.
    When maintaining the data structure of an aspect, you can select the field group that contains the relevant characteristics and basic key figures. This way you limit the number of fields offered.
    Regards
    Ashish

  • Examples of sorted hashed  internal tables

    Hello friends
    Can someone give me an example code in which sorted tables and hashed tables have been used.
    Regards

    hi Surya,
    Sorted tables
    This is the most appropriate type if you need a table which is sorted as you fill it. You fill sorted tables using the INSERT statement. Entries are inserted according to the sort sequence defined through the table key. Any illegal entries are recognized as soon as you try to add them to the table. The response time for key access is logarithmically proportional to the number of table entries, since the system always uses a binary search. Sorted tables are particularly useful for partially sequential processing in a LOOP if you specify the beginning of the table key in the WHERE condition.
    REPORT ZREPORT_SORTED1.
    DATA: BEGIN OF LINE,
    COL1 TYPE I,
    COL2 TYPE I,
    END OF LINE.
    DATA ITAB LIKE SORTED TABLE OF LINE WITH UNIQUE KEY COL1.
    DO 4 TIMES.
      LINE-COL1 = SY-INDEX.
      LINE-COL2 = SY-INDEX ** 2.
    INSERT LINE INTO TABLE ITAB.
    ENDDO.
    CLEAR LINE.
    READ TABLE ITAB WITH TABLE KEY COL1 = 3
                    INTO LINE TRANSPORTING COL2.
    WRITE:   'SY-SUBRC =', SY-SUBRC,
           / 'SY-TABIX =', SY-TABIX.
    SKIP.
    WRITE: / LINE-COL1, LINE-COL2.
    The output is:
    SY-SUBRC =    0
    SY-TABIX =       3
             0        9
    REPORT ZREPORT_SORTED2.
    DATA: BEGIN OF LINE,
            COL1 TYPE I,
            COL2 TYPE I,
          END OF LINE.
    DATA ITAB LIKE SORTED TABLE OF LINE WITH UNIQUE KEY COL1.
    DO 4 TIMES.
      LINE-COL1 = SY-INDEX.
      LINE-COL2 = SY-INDEX ** 2.
      INSERT LINE INTO TABLE ITAB.
    ENDDO.
    READ TABLE ITAB WITH KEY COL2 = 16  TRANSPORTING NO FIELDS.
    WRITE:   'SY-SUBRC =', SY-SUBRC,
           / 'SY-TABIX =', SY-TABIX.
    The output is:
    SY-SUBRC =    0
    SY-TABIX =       4
    Hashed tables
    This is the most appropriate type for any table where the main operation is key access. You cannot access a hashed table using its index. The response time for key access remains constant, regardless of the number of table entries. Like database tables, hashed tables always have a unique key. Hashed tables are useful if you want to construct and use an internal table which resembles a database table or for processing large amounts of data.
    REPORT ZREPORT_HASHED1.
    DATA: BEGIN OF LINE,
    COL1 TYPE I,
    COL2 TYPE I,
    END OF LINE.
    DATA ITAB LIKE HASHED TABLE OF LINE WITH UNIQUE KEY COL1.
    DO 4 TIMES.
      LINE-COL1 = SY-INDEX.
      LINE-COL2 = SY-INDEX ** 2.
    INSERT LINE INTO TABLE ITAB.
    ENDDO.
    LINE-COL1 = 2. LINE-COL2 = 3.
    READ TABLE ITAB FROM LINE INTO LINE COMPARING COL2.
    WRITE: 'SY-SUBRC =', SY-SUBRC.
    SKIP.
    WRITE: / LINE-COL1, LINE-COL2.
    The output is:
    SY-SUBRC =    2
             2        4
    REPORT ZREPORT_HASHED2.
    DATA: BEGIN OF LINE,
    COL1 TYPE I,
    COL2 TYPE I,
    END OF LINE.
    DATA ITAB LIKE HASHED TABLE OF LINE WITH UNIQUE KEY COL1.
    FIELD-SYMBOLS <FS> LIKE LINE OF ITAB.
    DO 4 TIMES.
      LINE-COL1 = SY-INDEX.
      LINE-COL2 = SY-INDEX ** 2.
    INSERT LINE INTO TABLE ITAB.
    ENDDO.
    READ TABLE ITAB WITH TABLE KEY COL1 = 2 ASSIGNING <FS>.
    <FS>-COL2 = 100.
    LOOP AT ITAB INTO LINE.
      WRITE: / LINE-COL1, LINE-COL2.
    ENDLOOP.
    The output is:
             1        1
             2      100
             3        9
             4       16
    Regards
    vijay

  • Differences between Standard , sorted and hashed internal tables

    Can any body please tell me what are the main Differences between
    1) <b>Standard internal table</b>
    2) <b>Hashed internal table</b>
    3) <b>Sorted internal table</b>
    Please give me a clear idea about these Three.
    Thanks
    Prabhudutta<b></b>

    Hi,
    <b>Standard Internal Tables</b>
    Standard tables have a linear index. You can access them using either the index or the key. If you use the key, the response time is in linear relationship to the number of table entries. The key of a standard table is always non-unique, and you may not include any specification for the uniqueness in the table definition.
    This table type is particularly appropriate if you want to address individual table entries using the index. This is the quickest way to access table entries. To fill a standard table, append lines using the (APPEND) statement. You should read, modify and delete lines by referring to the index (INDEX option with the relevant ABAP command).  The response time for accessing a standard table is in linear relation to the number of table entries. If you need to use key access, standard tables are appropriate if you can fill and process the table in separate steps. For example, you can fill a standard table by appending records and then sort it. If you then use key access with the binary search option (BINARY), the response time is in logarithmic relation to
    the number of table entries.
    <b>Sorted Internal Tables</b>
    Sorted tables are always saved correctly sorted by key. They also have a linear key, and, like standard tables, you can access them using either the table index or the key. When you use the key, the response time is in logarithmic relationship to the number of table entries, since the system uses a binary search. The key of a sorted table can be either unique, or non-unique, and you must specify either UNIQUE or NON-UNIQUE in the table definition.  Standard tables and sorted tables both belong to the generic group index tables.
    This table type is particularly suitable if you want the table to be sorted while you are still adding entries to it. You fill the table using the (INSERT) statement, according to the sort sequence defined in the table key. Table entries that do not fit are recognised before they are inserted. The response time for access using the key is in logarithmic relation to the number of
    table entries, since the system automatically uses a binary search. Sorted tables are appropriate for partially sequential processing in a LOOP, as long as the WHERE condition contains the beginning of the table key.
    <b>Hashed Internal Tables</b>
    Hashes tables have no internal linear index. You can only access hashed tables by specifying the key. The response time is constant, regardless of the number of table entries, since the search uses a hash algorithm. The key of a hashed table must be unique, and you must specify UNIQUE in the table definition.
    This table type is particularly suitable if you want mainly to use key access for table entries. You cannot access hashed tables using the index. When you use key access, the response time remains constant, regardless of the number of table entries. As with database tables, the key of a hashed table is always unique. Hashed tables are therefore a useful way of constructing and
    using internal tables that are similar to database tables.
    Regards
    Sudheer

  • What is the difference between standard,sorted and hash table

    <b>can anyone say what is the difference between standard,sorted and hash tabl</b>

    Hi,
    Standard Tables:
    Standard tables have a linear index. You can access them using either the index or the key. If you use the key, the response time is in linear relationship to the number of table entries. The key of a standard table is always non-unique, and you may not include any specification for the uniqueness in the table definition.
    This table type is particularly appropriate if you want to address individual table entries using the index. This is the quickest way to access table entries. To fill a standard table, append lines using the (APPEND) statement. You should read, modify and delete lines by referring to the index (INDEX option with the relevant ABAP command). The response time for accessing a standard table is in linear relation to the number of table entries. If you need to use key access, standard tables are appropriate if you can fill and process the table in separate steps. For example, you can fill a standard table by appending records and then sort it. If you then use key access with the binary search option (BINARY), the response time is in logarithmic relation to
    the number of table entries.
    Sorted Tables:
    Sorted tables are always saved correctly sorted by key. They also have a linear key, and, like standard tables, you can access them using either the table index or the key. When you use the key, the response time is in logarithmic relationship to the number of table entries, since the system uses a binary search. The key of a sorted table can be either unique, or non-unique, and you must specify either UNIQUE or NON-UNIQUE in the table definition. Standard tables and sorted tables both belong to the generic group index tables.
    This table type is particularly suitable if you want the table to be sorted while you are still adding entries to it. You fill the table using the (INSERT) statement, according to the sort sequence defined in the table key. Table entries that do not fit are recognised before they are inserted. The response time for access using the key is in logarithmic relation to the number of
    table entries, since the system automatically uses a binary search. Sorted tables are appropriate for partially sequential processing in a LOOP, as long as the WHERE condition contains the beginning of the table key.
    Hashed Tables:
    Hashes tables have no internal linear index. You can only access hashed tables by specifying the key. The response time is constant, regardless of the number of table entries, since the search uses a hash algorithm. The key of a hashed table must be unique, and you must specify UNIQUE in the table definition.
    This table type is particularly suitable if you want mainly to use key access for table entries. You cannot access hashed tables using the index. When you use key access, the response time remains constant, regardless of the number of table entries. As with database tables, the key of a hashed table is always unique. Hashed tables are therefore a useful way of constructing and
    using internal tables that are similar to database tables.
    Regards,
    Ferry Lianto

  • Creation of Sorted and Standard and Hashed Internal Tables ..

    Hi ..
    Pls  specify me.. how to create .. sorted ,Standard and Hashed Internal Tables...
    pls give me  the full code  regarding ...this ..
    Thnks

    Standard tables
    This is the most appropriate type if you are going to address the individual table entries using the index. Index access is the quickest possible access. You should fill a standard table by appending lines (ABAP APPEND statement), and read, modify and delete entries by specifying the index (INDEX option with the relevant ABAP command). The access time for a standard table increases in a linear relationship with the number of table entries. If you need key access, standard tables are particularly useful if you can fill and process the table in separate steps. For example, you could fill the table by appending entries, and then sort it. If you use the binary search option with key access, the response time is logarithmically proportional to the number of table entries.
    Sorted tables
    This is the most appropriate type if you need a table which is sorted as you fill it. You fill sorted tables using the INSERT statement. Entries are inserted according to the sort sequence defined through the table key. Any illegal entries are recognized as soon as you try to add them to the table. The response time for key access is logarithmically proportional to the number of table entries, since the system always uses a binary search. Sorted tables are particularly useful for partially sequential processing in a LOOP if you specify the beginning of the table key in the WHERE condition.
    Hashed tables
    This is the most appropriate type for any table where the main operation is key access. You cannot access a hashed table using its index. The response time for key access remains constant, regardless of the number of table entries. Like database tables, hashed tables always have a unique key. Hashed tables are useful if you want to construct and use an internal table which resembles a database table or for processing large amounts of data.
    Special Features of Standard Tables
    Unlike sorted tables, hashed tables, and key access to internal tables, which were only introduced in Release 4.0, standard tables already existed several releases previously. Defining a line type, table type, and tables without a header line have only been possible since Release 3.0. For this reason, there are certain features of standard tables that still exist for compatibility reasons.
    Standard Tables Before Release 3.0
    Before Release 3.0, internal tables all had header lines and a flat-structured line type. There were no independent table types. You could only create a table object using the OCCURS addition in the DATA statement, followed by a declaration of a flat structure:
    DATA: BEGIN OF <itab> OCCURS <n>,
    <fi> ...
    END OF <itab>.
    This statement declared an internal table <itab> with the line type defined following the OCCURS addition. Furthermore, all internal tables had header lines.
    The number <n> in the OCCURS addition had the same meaning as in the INITIAL SIZE addition from Release 4.0. Entering ‘0’ had the same effect as omitting the INITIAL SIZE addition. In this case, the initial size of the table is determined by the system.
    The above statement is still possible in Release 4.0, and has roughly the same function as the following statements:
    TYPES: BEGIN OF <itab>,
    <fi> ...,
    END OF <itab>.
    DATA <itab> TYPE STANDARD TABLE OF <itab>
    WITH NON-UNIQUE DEFAULT KEY
    INITIAL SIZE <n>
    WITH HEADER LINE.
    In the original statement, no independent data type <itab> is created. Instead, the line type only exists as an attribute of the data object <itab>.
    Standard Tables From Release 3.0
    Since Release 3.0, it has been possible to create table types using
    TYPES <t> TYPE|LIKE <linetype> OCCURS <n>.
    and table objects using
    DATA <itab> TYPE|LIKE <linetype> OCCURS <n> WITH HEADER LINE.
    The effect of the OCCURS addition is to construct a standard table with the data type <linetype>. The line type can be any data type. The number <n> in the OCCURS addition has the same meaning as before Release 3.0. Before Release 4.0, the key of an internal table was always the default key, that is, all non-numeric fields that were not themselves internal tables.
    The above statements are still possible in Release 4.0, and have the same function as the following statements:
    TYPES|DATA <itab> TYPE|LIKE STANDARD TABLE OF <linetype>
    WITH NON-UNIQUE DEFAULT KEY
    INITIAL SIZE <n>
    WITH HEADER LINE.
    They can also be replaced by the following statements:
    Standard Tables From Release 4.0
    When you create a standard table, you can use the following forms of the TYPES and DATA statements. The addition INITIAL SIZE is also possible in all of the statements. The addition WITH HEADER LINE is possible in the DATA statement.
    Standard Table Types
    Generic Standard Table Type:
    TYPES <itab> TYPE|LIKE STANDARD TABLE OF <linetype>.
    The table key is not defined.
    Fully-Specified Standard Table Type:
    TYPES <itab> TYPE|LIKE STANDARD TABLE OF <linetype>
    WITH NON-UNIQUE <key>.
    The key of a fully-specified standard table is always non-unique.
    Standard Table Objects
    Short Forms of the DATA Statement :
    DATA <itab> TYPE|LIKE STANDARD TABLE OF <linetype>.
    DATA <itab> TYPE|LIKE STANDARD TABLE OF <linetype>
    WITH DEFAULT KEY.
    Both of these DATA statements are automatically completed by the system as follows:
    DATA <itab> TYPE|LIKE STANDARD TABLE OF <linetype>
    WITH NON-UNIQUE DEFAULT KEY.
    The purpose of the shortened forms of the DATA statement is to keep the declaration of standard tables, which are compatible with internal tables from previous releases, as simple as possible. When you declare a standard table with reference to the above type, the system automatically adopts the default key as the table key.
    Fully-Specified Standard Tables:
    DATA <itab> TYPE|LIKE STANDARD TABLE OF <linetype>
    WITH NON-UNIQUE <key>.
    The key of a standard table is always non-unique.
    Internal table objects
    Internal tables are dynamic variable data objects. Like all variables, you declare them using the DATA statement. You can also declare static internal tables in procedures using the STATICS statement, and static internal tables in classes using the CLASS-DATA statement. This description is restricted to the DATA statement. However, it applies equally to the STATICS and CLASS-DATA statements.
    Reference to Declared Internal Table Types
    Like all other data objects, you can declare internal table objects using the LIKE or TYPE addition of the DATA statement.
    DATA <itab> TYPE <type>|LIKE <obj> WITH HEADER LINE.
    Here, the LIKE addition refers to an existing table object in the same program. The TYPE addition can refer to an internal type in the program declared using the TYPES statement, or a table type in the ABAP Dictionary.
    You must ensure that you only refer to tables that are fully typed. Referring to generic table types (ANY TABLE, INDEX TABLE) or not specifying the key fully is not allowed (for exceptions, refer to Special Features of Standard Tables).
    The optional addition WITH HEADER line declares an extra data object with the same name and line type as the internal table. This data object is known as the header line of the internal table. You use it as a work area when working with the internal table (see Using the Header Line as a Work Area). When you use internal tables with header lines, you must remember that the header line and the body of the table have the same name. If you have an internal table with header line and you want to address the body of the table, you must indicate this by placing brackets after the table name (<itab>[]). Otherwise, ABAP interprets the name as the name of the header line and not of the body of the table. You can avoid this potential confusion by using internal tables without header lines. In particular, internal tables nested in structures or other internal tables must not have a header line, since this can lead to ambiguous expressions.
    TYPES VECTOR TYPE SORTED TABLE OF I WITH UNIQUE KEY TABLE LINE.
    DATA: ITAB TYPE VECTOR,
    JTAB LIKE ITAB WITH HEADER LINE.
    MOVE ITAB TO JTAB. <- Syntax error!
    MOVE ITAB TO JTAB[].
    The table object ITAB is created with reference to the table type VECTOR. The table object JTAB has the same data type as ITAB. JTAB also has a header line. In the first MOVE statement, JTAB addresses the header line. Since this has the data type I, and the table type of ITAB cannot be converted into an elementary type, the MOVE statement causes a syntax error. The second MOVE statement is correct, since both operands are table objects.
    plz reward if useful

  • Difference between Info structure and Table

    Hi Friends
    I need to know difference between info structure and table (updating a table using a scheduled program),Which one of this is better and why?
    Please help me to get the Pros and Cons of the two available approach.
    Thanks
       Mitesh

    Hi,
         No different, these are just transparent tables like any other. You can select data from them the same as any other transparent table.
    Refer
    https://forums.sdn.sap.com/click.jspa?searchID=4342729&messageID=1424611
    https://forums.sdn.sap.com/click.jspa?searchID=4342729&messageID=3609095
    Regards

  • Difference between include structure and Append structure

    Could you please tell me
    I have bsis table and it contains append structure  in 4.7 SAP System.
    my program in 4.7 system contains internal table which used same structure of bsis table ( which contains additonal field in its append structure ).
    I need to have same table structure in 4.6 C because I am copying the same program into 4.6 system.
    As I could not append structure to bsis table in 4.6C SAP system,
    instead of that shall I add the field or Shall include the structure to run .
    What is the difference between Include structure and Append structure ( I forgot )
    How to achieve this please help me ?

    Hi ,
      As you know append structure can be used only once in table ,that to at last of all entries,
    Append structures are used for enhancements that are not included in the standard. This includes special developments, country versions and adding customer fields to any tables or structures.
    An append structure is a structure that is assigned to exactly one table or structure. There can be more than one append structure for a table or structure.
    The following enhancements can be made to a table or structure TAB with an append structure:
    Insert new fields in TAB,
    Define foreign keys for fields of TAB that already exist,
    Attach search helps to fields of TAB that already exist,
    These enhancements are part of the append structure, i.e. they must always be changed and transported with the append structure.
    When a table or structure is activated, all the append structures of the table are searched and the fields of these append structures are added to the table or structure. Foreign keys and search help attachments added using the append structure are also added to the table. If an append structure is created or changed, the table or structure assigned to it is also adjusted to these changes when the append structure is activated.
    Since the order of the fields in the ABAP Dictionary can differ from the order of the fields on the database, adding append structures or inserting fields in such append structures does not result in a table conversion.
    The customer creates append structures in the customer namespace. The append structure is thus protected against overwriting during an upgrade. The fields in the append structure should also reside in the customer namespace, that is the field names should begin with ZZ or YY. This prevents name conflicts with fields inserted in the table by SAP.
    The new versions of the standard tables are imported after an upgrade, and the fields, foreign key definitions and search help attachments contained in the append structures are added to the new standard tables at activation.
    A standard table contains the fields Field 1, Field 2 and Field 3. An append structure containing the fields ZZA and ZZB is defined for this table. After activating the table, the corresponding database table contains fields Field 1, Field 2, Field 3, ZZA and ZZB.
    Further Remarks:
    An append structure can only be assigned to exactly one table or structure. If you want to append the same fields to several tables or structures, you can store these fields in an include structure. In this case you must create an append structure for each of these tables or structures and include the include structure there.
    Adding an append structure to an SAP standard table is supported by the  Modification Assistant.
    If you want to insert a field that is to be delivered with the R/3 standard in the next Release in the customer system in advance, you must include it in the table itself as a repair. If you include such a field in an append structure for the table, it will occur twice when the new standard table is imported. This will result in an activation error.
    No append structures may be added to tables with long fields (data types VARC, LCHR or LRAW). This is because a long field must always be the last field in the table. However, structures with long fields can be enhanced with append structures.
    If a table or structure with an append structure is copied, the fields of the append structure become fields of the target table. Foreign key definitions and search help attachments appended with the append structure are copied to the target table.
    Foreign keys for the appended fields must be defined within the append structure. Fields of the table or structure assigned to the append structure may be defined when assigning the key field and foreign key field.
    Indexes on the appended fields must be defined in the original table.
    A table or structure TAB can only be enhanced with new foreign keys or search help attachments using an append structure. You therefore cannot change an existing foreign key definition or search help attachment for a field of TAB with the append structure.
    Thanks
    Manju

  • How to sort an internal table with a header line?

    hi all,
    i have declared table i_bseg type standard table of bseg with header line.
    now i have populated data in i_bseg.
    now i am sorting it by bukrs
    ie i am writing sort i_bseg by bukrs.
    before sorting all i_bseg-belnrs were populated...
    but after sorting the contents of  the i_bseg is changing.
    some of the belnrs are getting deleted..
    is there any special way to sort an internal table with header line...?

    hi,
    <b>SORT <itab> [ASCENDING|DESCENDING] [AS TEXT] [STABLE].</b>
    The statement sorts the internal table <itab> in ascending order by its key.<b> The statement always applies to the table itself, not to the header line</b>.
    If you have an internal table with a structured line type that you want sort by a different key, you can specify the key in the SORT statement:
    SORT <itab> [ASCENDING|DESCENDING] [AS TEXT] [STABLE]
                 BY <f1> [ASCENDING|DESCENDING] [AS TEXT]
                    <fn> [ASCENDING|DESCENDING] [AS TEXT].
    <b>this is your sort statement:  sort i_bseg by bukrs.
    you try with this statement:  sort i_bseg by bukrs STABLE.</b>
    regards,
    Ashokreddy

  • Create object/structure like dynamic internal table

    Hi,
    We have created dynamic internal table with some fields.
    for the above how to create structure or internal table like dynamic internal table structure .
    Scenario: internal table itab1 ( with header line) have 5 fields.
    Based on some of the conditions in layout of the report.
    we have to create dynamic internal table.
    field-symbols: <FS> type standard table.
    we are able to create dynamic internal table with 3 fields
    with assignment <fs> = itab1[]
    the columns are not appearing but data appearing in next column.
    how to solve this one
    Thanks
    Ramesh

    Hi Ramesh,
      I hope this code works...
    report  yup_alv_datbase                         .
    *-Display Database table contents in ALV Grid Format
    >********************************************************************
    This report displays data from SAP tables, views (like SE16)        *
    FM : REUSE_ALV_GRID_DISPLAY                                         *
    tables:
      dd02l,                               " SAP tables
      dd03l.                               " Table Fields
    type-pools: slis.                      " ALV Global Types
    selection-screen :
    begin of line, comment 1(35) v_1 for field p_table.         "#EC NEEDED
    parameters p_table like dd03l-tabname obligatory memory id dtb.
    selection-screen end of line.
    selection-screen :
    begin of line, comment 1(35) v_2 for field p_max.           "#EC NEEDED
    parameters p_max(2) type n default '20' obligatory.
    selection-screen end of line.
    at selection-screen.
      select single * from dd02l where tabname  = p_table
                                   and as4local = 'A'
                                   and as4vers  = '0000'.
      if sy-subrc ne 0.
      Table & is not active in the Dictionary
        message e402(mo) with p_table.
      elseif dd02l-tabclass = 'INTTAB'.
      & is a structure, not a table
        message e403(mo) with p_table.
      endif.
    initialization.
      v_1 = 'Table'.
      v_2 = 'Maximum of records'.
    start-of-selection.
      perform f_display_data.
         Form  F_DISPLAY_DATA
    form f_display_data.
    Macro definition
      define m_sort.
        add 1 to ls_sort-spos.
        ls_sort-fieldname = &1.
        ls_sort-up = 'X'.
        append ls_sort to lt_sort.
      end-of-definition.
      data:
        l_long type i,
        lp_struct   type ref to data,
        lp_table    type ref to data,      " Pointer to dynamic table
        of_sdescr   type ref to cl_abap_structdescr,
        ls_lvc_cat  type lvc_s_fcat,
        lt_lvc_cat  type lvc_t_fcat,       " Field catalog
        ls_fieldcat type slis_fieldcat_alv,
        lt_fieldcat type slis_t_fieldcat_alv,  " Field catalog
        ls_layout   type slis_layout_alv,
        lt_sort     type slis_t_sortinfo_alv,  " Sort table
        ls_sort     type slis_sortinfo_alv.
      field-symbols :
        <fieldcat>   type slis_fieldcat_alv,
        <lt_data>    type table,           " Data to display
        <fs>         type any,
        <components> type abap_compdescr.
    Dynamic creation of a structure
      create data lp_struct type (p_table).
      assign lp_struct->* to <fs>.
    Fields Structure
      of_sdescr ?= cl_abap_typedescr=>describe_by_data( <fs> ).
      loop at of_sdescr->components assigning <components>.
      Field MANDT not displayed
        if sy-tabix = 1 and <components>-name = 'MANDT'.
          continue.                        " Next loop
        endif.
      Build Fieldcatalog
        ls_lvc_cat-fieldname = <components>-name.
        ls_lvc_cat-ref_table = p_table.
        append ls_lvc_cat to lt_lvc_cat.
      Build Fieldcatalog
        ls_fieldcat-fieldname = <components>-name.
        ls_fieldcat-ref_tabname = p_table.
        append ls_fieldcat to lt_fieldcat.
      endloop.
    Create internal table
      call method cl_alv_table_create=>create_dynamic_table
        exporting it_fieldcatalog = lt_lvc_cat
        importing ep_table = lp_table.
      assign lp_table->* to <lt_data>.
    Read data
      select * from (p_table) up to p_max rows
        into corresponding fields of table <lt_data>
       order by primary key.
      if <lt_data>[] is initial.
      No table entries found for specified key
        message i429(mo).
        exit.
      endif.
    Read key field to Build Sort Table
      select * from dd03l where tabname  = p_table
                            and fieldname <> '.INCLUDE'
                            and as4vers  = '0000'
                            and as4local = 'A'
                          order by position.
        read table lt_fieldcat assigning <fieldcat>
                                with key fieldname = dd03l-fieldname.
        check sy-subrc eq 0.
        add dd03l-leng to l_long.
        if dd03l-keyflag = 'X'.
        Build Sort Table
          m_sort dd03l-fieldname.
          <fieldcat>-key = 'X'.
        elseif l_long > 150.
          <fieldcat>-tech = 'X'.
        endif.
      endselect.
      ls_layout-zebra = 'X'.
      ls_layout-colwidth_optimize = 'X'.
      call function 'REUSE_ALV_GRID_DISPLAY'
           exporting
                is_layout   = ls_layout
                it_fieldcat = lt_fieldcat
                it_sort     = lt_sort
           tables
                t_outtab    = <lt_data>.
    endform.                               " F_DISPLAY_DATA
    END OF PROGRAM Z_ALV_DYNAMIC_DATA *********************
    Regards,
    Sampath

  • Difference between Switching Structure in CCA and Transfer Structure in PC

    Hi experts,
    Could anybody define the difference between Switching Structure in CCA and Transfer Structure in CO-PCP? I can't also define when we create Primary Cost Component Split, do we use only range of Primary Cost Elements in the Cost Components for the Primary Cost Component Structure? Thanks for the help!
    Best Regards,
    Georgi

    This has been discussed please check it in forum
    https://forums.sdn.sap.com/click.jspa?searchID=480466&messageID=114309
    https://forums.sdn.sap.com/click.jspa?searchID=480466&messageID=1419481
    https://forums.sdn.sap.com/click.jspa?searchID=480466&messageID=1479212
    Shortly:
    Append structures are used for enhancements that are not included in the standard. An append structure is a structure that is assigned to exactly one table or structure. There can be more than one append structure for a table or structure.
    http://help.sap.com/saphelp_erp2004/helpdata/en/cf/21eb61446011d189700000e8322d00/content.htm
    Includes are used to group fields, an include structure can be assigned to many tables. If you add a fields to an include structure, all tables/structures, which contain that include structure, will be updated too.
    http://help.sap.com/saphelp_erp2004/helpdata/en/cf/21ea6a446011d189700000e8322d00/content.htm
    Regards,
    Santosh

  • Difference between Append structure and include structure

    hi can anyone tell me the difference between include structure and append structure with respect to tables defined in ABAP dictionary?
    Also how to create them in ABAP dictionary?

    HI
    INCLUDE:
    Includes are used to group fields and insert them together in a table or structure.
    An include program has two main functions:
    It contains code which can be used by several different programs.
    It helps you to modularize programs, which consist of many different logically related parts. Each of these parts is stored as a separate include program.
    Include programs improve the readability of programs and make maintenance easier.
    Include reports contain rolled out parts of reports. They are called by the main report, and can only be run in conjunction with the main report.
    APPEND:
    Append structures are used for enhancements that are not included in the standard. This includes special developments, country versions and adding customer fields to any tables or structures.
    An append structure is a structure that is assigned to exactly one table or structure. There can be more than one append structure for a table or structure.
    The following enhancements can be made to a table or structure TAB with an append structure:
    Insert new fields in TAB,
    Define foreign keys for fields of TAB that already exist,
    Attach search helps to fields of TAB that already exist
    Just have a look at this link:
    <a href="http://help.sap.com/saphelp_nw04/helpdata/en/cf/21ebd6446011d189700000e8322d00/frameset.htm">http://help.sap.com/saphelp_nw04/helpdata/en/cf/21ebd6446011d189700000e8322d00/frameset.htm</a>
    Rsgards,
    Gunasree.
    Award marks to helpful answers

  • Difference between append structure and include structure in DDIC

    Plz give me the apt difference between append structure and include structure in DDIC.
    Thanks in advance.
    Regards
    Raj

    This has been discussed please check it in forum
    https://forums.sdn.sap.com/click.jspa?searchID=480466&messageID=114309
    https://forums.sdn.sap.com/click.jspa?searchID=480466&messageID=1419481
    https://forums.sdn.sap.com/click.jspa?searchID=480466&messageID=1479212
    Shortly:
    Append structures are used for enhancements that are not included in the standard. An append structure is a structure that is assigned to exactly one table or structure. There can be more than one append structure for a table or structure.
    http://help.sap.com/saphelp_erp2004/helpdata/en/cf/21eb61446011d189700000e8322d00/content.htm
    Includes are used to group fields, an include structure can be assigned to many tables. If you add a fields to an include structure, all tables/structures, which contain that include structure, will be updated too.
    http://help.sap.com/saphelp_erp2004/helpdata/en/cf/21ea6a446011d189700000e8322d00/content.htm
    Regards,
    Santosh

  • Sort the internal table based on the vendor field

    hello experts,
    I am stuck with a small problem...
    I am uploading the data for partner association for vendors through lsmw BI program.
    I am collecting all the records in the end of trasaction and downloading all those records on to the apps server.
    I declared one internal table as
    TYPES: BEGIN OF type_erecord,
            mesg(1000) TYPE c,
            END OF type_erecord.
    DATA: t_precord type standard table of type_erecord initial size 0,
                w_precord type type_erecord.
    I am concatenating all the fields and moving to the internal table..
    concatenate zvendor_master-source  zvendor_master-lifnr  blf00-lifnr                   
                      zvendor_master-lname    zvendor_master-parvw
                      zvendor_master-psource  zvendor_master-pname
                      zvendor_master-lifn2        bwyt3-lifn2
                      zvendor_master-ekorg      zvendor_master-werks   
                      w_PLANT-muplant           zvendor_master-defpa
                      v_message
          into w_precord-mesg separated by c_pipe.
          append w_precord to t_precord.
    now at the end I have to sort this internal table t_precord based on blf00-lifnr
    can any one guide me how to do it
    Thanks for your anticipation
    Nitesha

    OK...
    Than you can create one more table and do the process of sorting and than put data into the final table.
    TYPES: BEGIN OF type_erecord,
    mesg(1000) TYPE c,
    END OF type_erecord.
    DATA: t_precord type standard table of type_erecord initial size 0,
    w_precord type type_erecord.
    TYPES: BEGIN OF type_erecord_1,
    mesg(1000) TYPE c,
    lifnr type blf00-lifnr ,  "<<<
    END OF type_erecord_1.
    DATA: t_precord_1 type standard table of type_erecord initial size 0,
    w_precord_1 type type_erecord.
    I am concatenating all the fields and moving to the internal table..
    concatenate zvendor_master-source zvendor_master-lifnr blf00-lifnr
    zvendor_master-lname zvendor_master-parvw
    zvendor_master-psource zvendor_master-pname
    zvendor_master-lifn2 bwyt3-lifn2
    zvendor_master-ekorg zvendor_master-werks
    w_PLANT-muplant zvendor_master-defpa
    v_message
    into w_precord_1-mesg separated by c_pipe.
    w_precord_1-lifnr = blf00-lifnr .  " <<<
    append w_precord_1 to t_precord_1.   " <<<
    SORT T_PRECORD_1 by LIFNR.  " <<
    LOOP AT T_PRECORD_1 into w_precord_1.
      move-corresponing w_precord_1 to w_precord.
      append w_precord to T_PRECORD.
      clear  w_precord .
    endloop.
    Regards,
    Naimesh Patel

  • What is the difference between (SEPA Structured) and (SEPA Unstructured)?

    Hi,
    Could you please teach me about "Format Payments (SEPA Structured)"
    and "Format Payments (SEPA Unstructured)"?
    1.What is Format Payments (SEPA Structured)?
    Is (SEPA Structured) used with which case?
    2.What is Format Payments (SEPA Unstructured)?
    Is (SEPA Unstructured) used with which case?
    3.What is the difference between (SEPA Structured) and (SEPA Unstructured)?
    The customer is checking Note.791226.1.
    However, he says that he cannot understand these two differences.
    Please teach me.
    Thanks.

    From the European Payments Council website:
    Remittance information: structure the unstructured
    The SEPA Credit Transfer Scheme permits the end-to-end carrying of remittance data on a structured or unstructured basis appropriate to the nature of the payment (the remittance information usually contains details of the contract underlying the transaction such as an invoice number, for example). The length of the remittance information in the SCT Scheme is fixed at a standard length of 140 characters and banks are obliged to pass on the full remittance information.
    The EPC supports a proposal developed by the European Association of Corporate Treasurers (EACT), which allows companies to agree on a structure for the remittance information. The EACT suggestion on how to structure the "unstructured" remittance fields allows companies exchanging a credit transfer to agree, among other, on information to be transmitted in a specific manner. Banks will carry remittance information structured in such an agreed way unaltered throughout the process chain.

Maybe you are looking for

  • Populate a table field based on another field in the same table

    Hi,     I have a table with fields collection profile and collection prfile text. When maintaining this table, the collection profile name should appear automatically ( from table UDM_COLL_GRPT) based on the collection profile entered.. In UDM_COLL_G

  • BIG problem with Mail after updating Mac OS X Leopard to 10.5.7

    Hi everyone, after updating OS X Leopard to 10.5.7, I noticed that all of my Mail accounts had disappeared. If I try to set them up again, Mail doesn't seem to be able to store them and after quitting and re-launching, they're gone. This had never ha

  • Average sales Value

    Hi Experts, I have faced a question that, in a query we have sales Value and 0Calday. But we need to calculate the Avg Sales Value Per day where as there will be thousands of records that will be updated daily.. I mean to sat that total sales value w

  • Filter for Created date: last week

    Im trying to put a filter on the Created date. We need to show only records from last week. Can anybody help me? Thanks in advance.

  • Synonyms no longer export in 1.1

    My laptop has a brand new lightroom installation where I'm using a new catalog created by Lightroom 1.1 containing new photos taken since the installation. When I export photos to jpeg, the assigned keywords and their parents get exported, but synony