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 a structure ??

0 Likes
842

hi friends,

i have a database table ztest - now what i want to do is, to load the contents of ztest into an internal table that has the same structure like ztest and 2 more fields. for me it would look like :

begin of str_tab,

itest like ztest,

a type string,

b type string,

end of str_tab.

does this work or do i have it to do another way ?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
778

Hi Clemens,

Its OK.

Regards

Younus

7 REPLIES 7
Read only

Former Member
0 Likes
778

try this..

TYPES : BEGIN OF STR_TAB.
        INCLUDE STRUCTURE ZTEST.
TYPES : A TYPE STRING,
        B TYPE STRING,
        END OF STR_TAB.

DATA : ITAB TYPE TABLE OF STR_TAB.

Message was edited by:

Chandrasekhar Jagarlamudi

Read only

Former Member
0 Likes
779

Hi Clemens,

Its OK.

Regards

Younus

Read only

sreeramkumar_madisetty
Active Contributor
0 Likes
778

Hi

Here in the declaration take a structure indtead of table.

U can include the structure in ur itab declaration.

Otherwise take as:

types : begin of i_tab,

feild1 type ztable-field1, etc ur fields,

add 2 more fields,

end of i_tab.

Regards,

Sreeram

Read only

Former Member
0 Likes
778

hi,

TYPES : BEGIN OF STR_TAB.

INCLUDE STRUCTURE ZTEST,

data: A TYPE STRING,

B TYPE STRING,

END OF STR_TAB.

DATA : ITAB TYPE TABLE OF STR_TAB.

helpful reward some points.

with regards,

suresh babu aluri.

Read only

Former Member
0 Likes
778

Hi Clemens,

It is definitely OK to use the code in the way that u represented, but it would be even better if you could use INCLUDE STRUCTURE.

Regards,

kiran

Read only

0 Likes
778

hi, i did it this way:

TYPES:

begin of str_tab,

itest like ztest,

a type string,

b type string,

end of str_tab.

DATA:

i_tab_ztest TYPE STANDARD TABLE OF str_tab,

now, what doesn't work is

ztest has a field kunnr and for binary search ( i want to search for an entry within ztest ) i want to sort the ztest structure by kunnr.

SORT i_tab_ztest BY itest-kunnr.

why or how does/n't this work ?

Read only

0 Likes
778

hi clemens,

you have to use this as,

sort i_tab_ztest by ztest-kunnr.

and it works,

Regards,

kiran