Skip to Content
avatar image
Former Member

nested structures

hi all, i m new to nested structures, i want to code using it, the output should show the year, months, days, 24 hour division for day and finally the capacity column for per hour... plz help it is very very urgent.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    Aug 20, 2007 at 08:36 AM

    Hi,

    Check the following code:

    report ztx0803.

    data: begin of names,

    name1 like ztxkna1-name1,

    name2 like ztxkna1-name2,

    end of names.

    data: begin of cust_info,

    number(10) type n,

    nm like names, "like a field string

    end of cust_info.

    cust_info-number = 15.

    cust_info-nm-name1 = 'Jack'.

    cust_info-nm-name2 = 'Gordon'.

    write: / cust_info-number,

    cust_info-nm-name1,

    cust_info-nm-name2.

    Hope this helps.

    Reward if helpful.

    Regards,

    Sipra

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 20, 2007 at 09:16 AM

    Hello,

    The structure of a data object can be an

    elementary field, a

    structure, or an

    internal table.

    Structures and internal tables are complex data obejcts. Since it is possible to combine structures and internal tables in any way, we can can also make a general distinction between different types of structures, internal tables, and data structures.

    A structure can be:

    A <b>simple structure</b> (as opposed to complex structures). A simple structure is a structure with elementary components.

    A <b>nested structure</b>. A nested structure is a structure containing one or more further structures.

    A <b>deep structure</b>. Deep structures are structures that contain an internal table as a component, either directly or indirectly).

    Here is the sample program with nested structures

    REPORT structure1.

    TYPES: BEGIN OF name,

    title(5) TYPE c,

    first_name(10) TYPE c,

    last_name(10) TYPE c,

    END OF name.

    TYPES: BEGIN OF mylist,

    client TYPE name,

    number TYPE i,

    END OF mylist.

    DATA list TYPE mylist.

    list-client-title = 'Lord'.

    list-client-first_name = 'Howard'.

    list-client-last_name = 'Mac Duff'.

    list-number = 1.

    WRITE list-client-title.

    WRITE list-client-first_name.

    WRITE list-client-last_name.

    WRITE / 'Number'.

    WRITE list-number.

    reward if helpful,

    Regards,

    LIJO JOHN

    Add comment
    10|10000 characters needed characters exceeded