4 Replies Latest reply: May 10, 2010 4:16 PM by vijay kns 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.

Actions