Application Development and Automation 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: 
Read only

include table in structure

Former Member
0 Likes
9,723

Hi,

I've a requirement wherein i have to define a internal table , this internal table should have all fields of a standard table say MARA plus some new fields. I don't want to declare its as follows,

begin of rec,

fielda like mara-fielda,

fieldb like mara-fieldb,

customfield type i,

end of rec.

I've tried following method,

begin of rec,

include type MARA,

customfield type i,

end of rec.

But for any field of mara in structure i've refer to it as tab_include-fielda .....Is there any way to refer to it directly like tab-fielda (tab is my internal table of type rec)

Bye

8 REPLIES 8
Read only

Former Member
0 Likes
4,355

>Types: begin of t_maraplus,

> field1 type ... ,

> field2 type... . " full stop

> Include structure mara." full stop.

>types: field3 type ... ,

> end of t_maraplus.

>

>data: itab type table of t_mara with header line.

Read only

JozsefSzikszai
Active Contributor
4,355
TYPES : BEGIN OF ty_... .
INCLUDE STRUCTURE mara. "to include all fields of mara
TYPES : field1 TYPE ..., "all other fields
field2 TYPE ...
END OF ty_... .

* work area
DATA wa_... TYPE ty_... .

* internal table
DATA : it_... TYPE TABLE OF ty_... .
Read only

0 Likes
4,355

Hi,

Thanks for your interest, Ive tried following code but its giving syntax error

begin of st_it,

include structure mara,

pick,

end of st_it.

The syntax error is "," expected after include.

Kindly help.

Read only

0 Likes
4,355

begin of st_it,

include structure mara,

pick,

end of st_it.

try:

>types: begin of st_it.

>types: include structure mara,

> pick,

> end of st_it.

Read only

0 Likes
4,355

Hi Mac,

You need to write your code like this:

DATA: begin of st_it.

include structure mara.

data: pick,

end of st_it.

try this and let me know.

Regards,

Prakash Pandey

Read only

0 Likes
4,355

Hi,

You can do one thing

Go to se11 and create a structure say ZMARA.

there include mara and your other required fields in structure ZMARA like .INCLUDE in field name and MARA in component name.

in se 38 declare 'itab like table of zmara with header line' and use the itab

thanks nd regards

Arjun

Read only

0 Likes
4,355

beware at the last character of the line, I highlighted:

TYPES : BEGIN OF ty_... . "dot
INCLUDE STRUCTURE mara. "dot 
TYPES : field1 TYPE ..., "comma
field2 TYPE ..., "comma
END OF ty_... . "dot

Read only

Former Member
0 Likes
4,355

thnx guys