5 Replies Latest reply: Jun 3, 2015 7:32 AM by GANESH RAJENDRAN RSS

Deep Structure

Shipra verma
Currently Being Moderated

Hi

 

Can anybody please tell me that

1) What is DEEP STRUCTURE.

2) What is the advantage of DEEP STRUCTURE.

3) Why and When we create it in DDIC.

4) Why and When we create it in ABAP Programs(Reports, Module pool Programs etc.)

 

THANKS IN ADVANCE

PLEASE REPLY SOON.

 

 

Shipra

  • Re: Deep Structure
    Srinivasa Bhanuprasad Moningi
    Currently Being Moderated

    Hi Shipra,

     

    A structure is a sequence of any elementary types, reference types, or complex data types.

     

    You use structures in ABAP programs to group work areas that logically belong together. Since the elements of a structure can have any data type, structures can have a large range of uses. For example, you can use a structure with elementary data types to display lines from a database table within a program. You can also use structures containing aggregated elements to include all of the attributes of a screen or control in a single data object.

     

    The following terms are important when we talk about structures:

     

    Nested and non-nested structures

    Flat and deep structures

    A nested structure is a structure that contains one or more other structures as components. Flat structures contain only elementary data types with a fixed length (no internal tables, reference types, or strings). The term deep structure can apply regardless of whether the structure is nested or not. Nested structures are flat so long as none of the above types is contained in any nesting level.

     

    Any structure that contains at least one internal table, reference type, or string as a component (regardless of nesting) is a deep structure. Accordingly, internal tables, references, and strings are also known as deep data types. The technical difference between deep structures and all others is as follows. When you create a deep structure, the system creates a pointer in memory that points to the real field contents or other administrative information. When you create a flat data type, the actual field contents are stored with the type in memory. Since the field contents are not stored with the field descriptions in the case of deep structures, assignments, offset and length specifications and other operations are handled differently from flat structures.

     

    Hope this helps.

     

    Thanks,

    Srinivasa

  • Re: Deep Structure
    ilesh Nandaniya
    Currently Being Moderated

    Hi Shipra,

     

    structures containing internal tables as components or

    Internal table containing Structure as components are called Deep Internal table.

     

    Please check this link for reading a deep structure.

     

    Re: Read a Deep Structure

     

    Example:

    TYPES: BEGIN OF TYPE_DEEP,

    MATNR TYPE MATNR,

    T_MARC TYPE MARC OCCURS 0,

    END OF TYPE_DEEP.

     

    DATA: T_DEEP TYPE STANDARD TABLE OF TYPE_DEEP.

    DATA: WA_DEEP TYPE TYPE_DEEP.

    DATA: T_MARC TYPE TABLE OF MARC.

    DATA: S_MARC TYPE MARC.

     

    • Populating data.

    WA_DEEP-MATNR = 'TEST'.

    S_MARC-MATNR = 'TEST'.

    S_MARC-WERKS = '9090'.

    APPEND S_MARC TO T_MARC.

     

    • Append second level internal table.

    WA_DEEP-T_MARC[] = T_MARC[].

     

    • Append.

    APPEND WA_DEEP TO T_DEEP.

     

     

    • Process the internal table.

     

    LOOP AT T_DEEP INTO WA_DEEP.

     

    WRITE: / WA_DEEP-MATNR.

     

    • PROCESS the second level internal table.

    LOOP AT WA_DEEP-T_MARC INTO S_MARC.

     

    WRITE: S_MARC-WERKS.

    ENDLOOP.

    ENDLOOP.

     

    See the information of Structure in the below link also...

     

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

     

    Hope it will solve your problem..

     

    <b>Reward points if useful..</b>

     

    Thanks & Regards

    ilesh 24x7

  • Re: Deep Structure
    Currently Being Moderated

    hI

     

    structures containing internal tables as components or

    Internal table containing Structure as components are called Deep Internal table.

     

     

    A nested structure is a structure that contains one or more other structures as components. Flat structures contain only elementary data types with a fixed length (no internal tables, reference types, or strings). The term deep structure can apply regardless of whether the structure is nested or not. Nested structures are flat so long as none of the above types is contained in any nesting level.

     

    Any structure that contains at least one internal table, reference type, or string as a component (regardless of nesting) is a deep structure. Accordingly, internal tables, references, and strings are also known as deep data types. The technical difference between deep structures and all others is as follows. When you create a deep structure, the system creates a pointer in memory that points to the real field contents or other administrative information. When you create a flat data type, the actual field contents are stored with the type in memory. Since the field contents are not stored with the field descriptions in the case of deep structures, assignments, offset and length specifications and other operations are handled differently from flat structures.

     

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

     

    Please check this link for reading a deep structure.

     

    Re: Read a Deep Structure

     

    Example:

    TYPES: BEGIN OF TYPE_DEEP,

    MATNR TYPE MATNR,

    T_MARC TYPE MARC OCCURS 0,

    END OF TYPE_DEEP.

     

    DATA: T_DEEP TYPE STANDARD TABLE OF TYPE_DEEP.

    DATA: WA_DEEP TYPE TYPE_DEEP.

    DATA: T_MARC TYPE TABLE OF MARC.

    DATA: S_MARC TYPE MARC.

     

    • Populating data.

    WA_DEEP-MATNR = 'TEST'.

    S_MARC-MATNR = 'TEST'.

    S_MARC-WERKS = '9090'.

    APPEND S_MARC TO T_MARC.

     

    • Append second level internal table.

    WA_DEEP-T_MARC[] = T_MARC[].

     

    • Append.

    APPEND WA_DEEP TO T_DEEP.

     

     

    • Process the internal table.

     

    LOOP AT T_DEEP INTO WA_DEEP.

     

    WRITE: / WA_DEEP-MATNR.

     

    • PROCESS the second level internal table.

    LOOP AT WA_DEEP-T_MARC INTO S_MARC.

     

    WRITE: S_MARC-WERKS.

    ENDLOOP.

    ENDLOOP.

  • Re: Deep Structure
    GANESH RAJENDRAN
    Currently Being Moderated

    This the simple example for deep structure.

    TYPES : BEGIN OF ty_string,

            string1(20) TYPE c,

            string2(20) TYPE c,

            string3(20) TYPE c,

       END OF  ty_string.

     

    TYPES tt_tab TYPE  TABLE OF ty_string.

    DATA t_tab TYPE tt_tab.

     

    TYPES : BEGIN OF ty_mara,

             matnr   TYPE matnr,

             ersda   TYPE ersda,

          END OF ty_mara,

     

      BEGIN OF ty_test,

         matnr  TYPE matnr,

         ersda  TYPE ersda,

         text1  LIKE t_tab,

        END OF ty_test.

     

    DATA lt_test TYPE STANDARD TABLE OF ty_string.

    DATA test    LIKE LINE OF lt_test..

    test-string1 = 'ganesh'.

    test-string2 = 'guna'.

    test-string3 = 'raj'.

    APPEND test TO lt_test.

    *

    DATA : lt_mara  TYPE STANDARD TABLE OF ty_mara.

    DATA : ls_mara  LIKE LINE OF  lt_mara.

    DATA : lt_marat TYPE STANDARD TABLE OF ty_test.

    DATA   ls_marat LIKE LINE OF lt_marat.

     

    SELECT matnr ersda FROM mara INTO  TABLE lt_mara UP TO 10 ROWS.

    LOOP AT lt_mara INTO ls_mara.

       ls_marat-matnr   = ls_mara-matnr.

       ls_marat-ersda   = ls_mara-ersda.

       ls_marat-text1   = lt_test.

       APPEND ls_marat TO lt_marat.

    ENDLOOP.

    BREAK-POINT.

Actions