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

Regarding select statement

Former Member
0 Likes
748

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 statement

The dataelements and lengths are same

Thanks in advance

1 ACCEPTED SOLUTION
Read only

JozsefSzikszai
Active Contributor
0 Likes
724

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

7 REPLIES 7
Read only

Former Member
0 Likes
724

how can u pass if they are of different types

Read only

Former Member
0 Likes
724

hi,

i think its not possible...

If fieldname is different u will not get data from table.

Read only

former_member386202
Active Contributor
0 Likes
724

Hi,

declare internal tabl etype ztable

data : itab1 like ztable occurs 0 with header line

select f1 f2 f3 from ztable into itab1 .

loop at itab1.

itab2-f1 = itab1-f1.

itab2-f2 = itab1-f2.

itab2-f3 = itab1-f3.

Append itab2.

Endloop.

Regards,

Prashant

Read only

Former Member
0 Likes
724

hi,

i have no clue about your issue,but you could declare your internal table like

data: Begin of itab,

field1 like ztable1-fieldname,

field2 like ztable2-fieldname,

endof itab.

and you can use select * from zable1 into corresponding fields of table itab.

which i think would be easier way ...i any issue in this let me know

regards,

karthik

Read only

Former Member
0 Likes
724

Hi ,

Try this select statement:

select single from Ztable-field name1 into itab-fieldname1.

select single from Ztable-field name2 into itab-fieldname2.

select single from Ztable-field name3 into itab-fieldname3.

May be helpful...

Reward points if found helpful……

Cheers,

Chandra Sekhar.

Read only

Former Member
0 Likes
724

hi

select f1 f2 f3 into itab-a1 itab-a2 itab-a3 from ztable1.

regards,

pavan

Read only

JozsefSzikszai
Active Contributor
0 Likes
725

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