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

deep structure

Hii All,

how to access deep strucvture data

in my case

SHP_SERNR_UPDATE_T is a table type and

SHP_SERNR_UPDATE_S is the struture in thi table

..

how to declare in my program to access this structure and table..

plzz give one example of of this..

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Dec 03, 2007 at 11:23 AM

    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.

    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.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 03, 2007 at 11:24 AM

    Hi!

    DATA: gt_sernr LIKE SHP_SERNR_UPDATE_T,

    wa_sernr LIKE LINE OF gt_sernr.

    LOOP AT gt_sernr INTO wa_sernr.

    MOVE 'A' TO wa_sernr-SHP_SERNR_UPDATE_S-field.

    MODIFY gt_sernr FROM wa_sernr INDEX sy-tabix.

    ENDLOOP.

    Regards

    Tamá

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi!

      DATA: gt_sernr LIKE SHP_SERNR_UPDATE_T, "itab using the table type

      wa_sernr LIKE LINE OF gt_sernr. "line of the itab

      LOOP AT gt_sernr INTO wa_sernr.

      WRITE:/ wa_sernr-SHP_SERNR_UPDATE_S-RFBEL,

      wa_sernr-SHP_SERNR_UPDATE_S-RFPOS,

      wa_sernr-SHP_SERNR_UPDATE_S-SERNR. "put a - sign before the field name

      ENDLOOP.

      Regards

      Tamá

  • author's profile photo Former Member
    Former Member
    Posted on Dec 03, 2007 at 11:31 AM

    Hi

    DATA: <TABLE> TYPE SHP_SERNR_UPDATE_T,

    <WORK AREA> TYPE SHP_SERNR_UPDATE_S.

    So you can read the table by LOOP or READ TABLE statament

    LOOP AT <TABLE> INTO <WOR AREA>.

    ENDLOOP.

    READ TABLE <TABLE> INTO <WORK AREA>.

    If there's a table in the structure, you need to declare a new work area like that table:

    DATA: <WORK AREA 2> TYPE ............
    
    LOOP AT <TABLE> INTO <WOR AREA>.
        LOOP AT <WORK AREA>-ITAB INTO <WORK AREA 2>.
        ENDLOOP.
    ENDLOOP.

    Max

    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.