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

Including DB table structure to itab

Former Member
0 Likes
846

Hi there. I'd like to create an itab which would contain some DB table structure and there is one more field apart from that structure. So I need to do sth like this:


DATA: BEGIN OF itab OCCURS 0 ,
        INCLUDE STRUCTURE tablename ,
		my_field LIKE my_datatype ,
      END OF itab .

Could You suggest me how should I code that? Greetings. P.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
828

DATA: BEGIN OF itab OCCURS 0 ,

INCLUDE STRUCTURE <tablename> ,

<field> LIKE <dataelemen> ,

END OF itab .

This is how u need to add the code so that the table structure is included in ur internal table as well as the field is also included.

DATA: BEGIN OF itab OCCURS 0 ,

INCLUDE STRUCTURE MARA,

var1 LIKE vbak-vbeln,

var2 type c,

END OF itab .

Hi there. I'd like to create an itab which would contain some DB table structure and there is one more field apart from that structure. So I need to do sth like this:


DATA: BEGIN OF itab OCCURS 0 ,
        INCLUDE STRUCTURE tablename ,
		my_field LIKE my_datatype ,
      END OF itab .

Could You suggest me how should I code that? Greetings. P.

6 REPLIES 6
Read only

Former Member
0 Likes
828

Types: Begin Of Ty_STR.

Include Structure <DBTAB>.

Types: Flag Type C,

End of Ty_STR.

Data: T_ITAB Type Standard Table Of Ty_STR,

W_STR Type Ty_STR.

santhosh

Read only

Former Member
0 Likes
829

DATA: BEGIN OF itab OCCURS 0 ,

INCLUDE STRUCTURE <tablename> ,

<field> LIKE <dataelemen> ,

END OF itab .

This is how u need to add the code so that the table structure is included in ur internal table as well as the field is also included.

DATA: BEGIN OF itab OCCURS 0 ,

INCLUDE STRUCTURE MARA,

var1 LIKE vbak-vbeln,

var2 type c,

END OF itab .

Read only

Former Member
0 Likes
828

Write like this ...

DATA: BEGIN OF itab OCCURS 0 .

INCLUDE STRUCTURE tablename .

DATA : my_field LIKE my_datatype ,

END OF itab .

Read only

Former Member
0 Likes
828

do like this


types:  struct_table type STRUCTURE  of tablename .

DATA: BEGIN OF itab OCCURS 0 ,
        INCLUDE STRUCTURE struct_table
		my_field LIKE my_datatype ,
      END OF itab .

<REMOVED BY MODERATOR>

vivek

Edited by: Alvaro Tejada Galindo on Feb 25, 2008 2:52 PM

Read only

Former Member
0 Likes
828

Hi,


DATA: BEGIN OF itab OCCURS 0 ,
          INCLUDE STRUCTURE tablename.
DATA : my_field LIKE my_datatype,
      END OF itab .

try like this....It will surely works.

Thanks,

Sakthi C

<REMOVED BY MODERATOR>

Edited by: Alvaro Tejada Galindo on Feb 25, 2008 2:53 PM

Read only

Former Member
0 Likes
828

Hi,

You can declare that in the following way.

Example,

DATA BEGIN OF itab OCCURS 0.

INCLUDE STRUCTURE <Tab Name>.

DATA <Field name> type char10.

DATA END OF itab.

Regards,

Jalendahr