12-13-2007 12:09 PM
Hi everybody,
I have to get only three fields form a Ztable and pass them to an internal table(which is of type another Ztable)
Field names are different in the Ztable and the internal table
Please give me the SELECT ststement
Thanks in advance
12-13-2007 1:08 PM
hi Ajay,
fields in ztable: z1, z2, z3
fields in internal table: i1, i2, i3.
SELECT z1 AS i1
z2 AS i2
z3 AS i3
FROM ztable
INTO CORRESPONDING FIELDS OF TABLE itab
WHERE ...
hope this helps
ec
12-13-2007 12:12 PM
Try this...
SELECT <fld> <fld2> <fld3> INTO (itab-fld1, itab-fld2, itab-fld3) FROM <tab>
WHERE <COND>.
APPEND itab.
ENDSELECT.
12-13-2007 12:13 PM
Hi,
let me know all the 3 fields are having same data type and lengths?
send me those fields.
thanks,
Sreeram.
12-13-2007 12:21 PM
Yes all the three fields have same datatypes and lengths
Only the field headings have been chaned
regards
12-13-2007 12:13 PM
Hi Ajay,
Create a structure called zxxx
IN ZXXX CREATE THE 3 FIELDS FROM THE ZTABLE
BEGIN OF ITAB OCCURS 0
INCLUDE STRUCTURE ZXXX
END OF ITAB.
Regards,
Sreenivas
12-13-2007 12:13 PM
select field1 field2 field3
from ztable
into (ls_struct_table2-fieldx,s_struct_table2-fieldy,s_struct_table2-fieldz)
where ....
append ls_struct_table2 to table2.
endselect.
This code is very dangerous but, now i only remember this form.
Luck
12-13-2007 12:17 PM
hi,
Ajay
do neccasary data declarations
select f1 f2 f3
from ztable1
into (v1, v2, v3)
ztable2-f1 = v1.
ztable2-f2 = v2.
ztable2-f3 = v3.
append ztable2.
endselect.
plzzzzzz reward if useful
feel free to ask any quieries my mail id is mutyalasunilkumar@gmail.com
12-13-2007 12:59 PM
Dear Ajay,
Assuming zfield1, zfield2, and zfield3 to be the three fields in your ZTABLE AND
I_ZTAB to be the internal table of the structure type ZTABLE with different field names:
SELECT ZFIELD1 ZFIELD2 ZFIELD3
FROM ZTABLE
INTO <I_ZTAB-Field1> <I_ZTAB-Field2> <I_ZTAB-Field3>
WHERE <CONDITION>.
ENDSELECT.
Regards,
Raj
<b>Please reward points if helpful.</b>
12-13-2007 1:06 PM
hi.
use this code
data : begin of itab occurs 0,
f1 like ztable-fn1,
f2 like ztable-fn2,
end of itab.
select fn1 fn2 from table ztable into corresponding feilds of table itab .
reward if useful
12-13-2007 1:08 PM
hi Ajay,
fields in ztable: z1, z2, z3
fields in internal table: i1, i2, i3.
SELECT z1 AS i1
z2 AS i2
z3 AS i3
FROM ztable
INTO CORRESPONDING FIELDS OF TABLE itab
WHERE ...
hope this helps
ec