‎2007 May 11 1:20 PM
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 ?
‎2007 May 11 1:23 PM
‎2007 May 11 1:23 PM
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
‎2007 May 11 1:23 PM
‎2007 May 11 1:24 PM
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
‎2007 May 11 1:28 PM
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.
‎2007 May 11 1:29 PM
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
‎2007 May 11 1:46 PM
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 ?
‎2007 May 11 1:54 PM
hi clemens,
you have to use this as,
sort i_tab_ztest by ztest-kunnr.
and it works,
Regards,
kiran