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

Define structure with table type fields using keyword "TYPES"

Hi Gurus,

Using keyword "TYPES", I want to define a structure in which there is a field must be table type. It seems not allowed. For example:

TYPES tt_items TYPE TABLE OF sflight.

TYPES: BEGIN OF str,

field1 TYPE i,

field_tabl TYPE tt_items.

TYPES: END OF str.

Then I got a syntax error:

"TT_ITEMS" is a generic type. Use of this type is only possible for typing field symbols and formal parameters. -

What should I do if I want to have a table type field in it?

Thanks a lot.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Posted on Aug 30, 2007 at 03:01 AM

    I believe you have to do it like this.

    
    TYPES: tt_items TYPE sflight OCCURS 0.
    
    TYPES: BEGIN OF str,
           field1 TYPE i,
           field_tabl TYPE  tt_items,
           END OF str.
    
    

    Regards,

    RIch Heilman

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Aug 30, 2007 at 03:08 AM

    Do something like this...

    TYPES : BEGIN OF ty_ekko.
    INCLUDE  TYPE ekko.
    TYPES : chk(1) TYPE c.
    TYPES : END OF ty_ekko.
    
    DATA : it_ekko TYPE STANDARD TABLE OF ty_ekko,
           is_ekko TYPE ty_ekko.

    Regards

    Gopi

    Add a comment
    10|10000 characters needed characters exceeded

    • include type EKKO includes the whole strucutre of EKKO.

      if you see the structure in debug mode, it_ekko contains the fields of EKKO as well as the field CHK of type C.

      In your case you can do this

      TYPES: BEGIN OF str.
      INCLUDE TYPE sflight.  " includes whole structure of SFLIGHT
      TYPES : field1 TYPE i. " include the field1 of type I
      TYPES: END OF str.
      
      DATA : it_str TYPE TABLE OF str, " internal table
             is_str TYPE str.          " work area
      

      Regards

      Gopi

  • Posted on Aug 30, 2007 at 07:08 AM

    Hii..

    You can do this very much..

    Change the code like this:

    TYPES tt_items TYPE TABLE OF sflight.

    TYPES: BEGIN OF str,

    field1 TYPE i,

    field_tabl TYPE LINE OF tt_items. "Component with a structurebased on table type

    TYPES: END OF str.

    <b>reward if Helpful</b>

    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.