‎2008 Nov 14 8:49 AM
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
‎2008 Nov 14 8:51 AM
>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.
‎2008 Nov 14 8:56 AM
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_... .
‎2008 Nov 14 8:59 AM
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.
‎2008 Nov 14 9:03 AM
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.
‎2008 Nov 14 9:04 AM
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
‎2008 Nov 14 9:45 AM
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
‎2008 Nov 14 10:04 AM
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
‎2008 Nov 14 11:06 AM