Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Declare Types using a custom table

Former Member
0 Kudos

Hi,

I am creating a new structure in my program in ABAP Editor. The fields of this table will be all the fields in a custom table plus an additional field which is not a part of this table. The table has some 150 fields so I need to include it in my structure. I am using it in this way but its giving error:

TYPES: BEGIN OF t_struct,

INCLUDE TYPE zcustom_table,

zzfield TYPE c,

END OF t_struct.

This structure is getting created but giving an error when I am creating a table of this type as:

DATA : i_tab TYPE STANDARD TABLE OF t_struct WITH HEADER LINE.

Please suggest me how can get rid if this error.

Thanks,

Abhishek

1 ACCEPTED SOLUTION

JozsefSzikszai
Active Contributor

hi,

you have to code like this:

TYPES: BEGIN OF t_struct.
INCLUDE STRUCTURE zcustom_table.
TYPES : zzfield TYPE c,
END OF t_struct.

work area:
DATA : gw_struct TYPE t_struct.

internal table:
DATA : gt_struct TYPE STANDARD TABLE of t_struct.

hope this helps

ec

2 REPLIES 2

JozsefSzikszai
Active Contributor

hi,

you have to code like this:

TYPES: BEGIN OF t_struct.
INCLUDE STRUCTURE zcustom_table.
TYPES : zzfield TYPE c,
END OF t_struct.

work area:
DATA : gw_struct TYPE t_struct.

internal table:
DATA : gt_struct TYPE STANDARD TABLE of t_struct.

hope this helps

ec

prasanth_kasturi
Active Contributor
0 Kudos

Hi,

the syntax you declared is wrong,

check the below code , it will solve your problem



TYPES: BEGIN OF t_struct.
INCLUDE TYPE zcustom_table.
types : zzfield TYPE c.
types : END OF t_struct.

DATA : i_tab TYPE STANDARD TABLE OF t_struct WITH HEADER LINE.

regards

prasanth