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

select statement

Former Member
0 Likes
607

Hi guyz,

I have an issue with the select statement.

the following code is existing in my program to select.

select objnr gjahr appending i_cost

from coss

for all entries in i_aufnr

where objnr = i_aufnr-objnr

and gjahr in s_gjahr

and kstar in (c_labor, c_overhead).

now i have to include some more values for the cost element (coss-kstar) viz (c_ele1,c_ele2,c_ele3).

can i write the code like :

kstar in (c_labor, c_overhead, c_ele1,c_ele2,c_ele3).

if not, how shd write the select statement?

plz suggest me.

thanks a lot in advance.

venu

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
585

Hi

Yes you can.

- Kalidas

6 REPLIES 6
Read only

Former Member
0 Likes
585

Hi Venu,

You can write the code that way.You can specify any no. of values.

Phani.

Read only

Former Member
0 Likes
585

you can write like that, are you facing any problem..

regards

vijay

Read only

Former Member
0 Likes
586

Hi

Yes you can.

- Kalidas

Read only

Former Member
0 Likes
585

If you want it to be more flexible, define a range for that field and fill it as follows.


ranges: r_kstart for coss-kstar.

r_kstar-low    = c_ele1.
r_kstar-option = 'EQ'.
r_kstar-sign   = 'I'.

append r_kstar.

You can fill all others using the same logic. Even better would be to make it as a select-option and prefill it just like above in the INITIALIZATION event. If the users want to add more cost elements in the future, they can simply add it to this select option, instead of you changing the program everytime.

Srinivas

Read only

Former Member
0 Likes
585

thanks a lot guyz

Venu

Read only

Former Member
0 Likes
585

Hi Venu,

You can specify values but there is a limitation on SQL statement generated by SAP at Kernal.. If you have too many values not only in this IN statement (Individual or Internal table ).. SAP created SQL statement at Runtime will give dump if it exceeds the limit..

You are ok with this one.. but just keep in mind.

-Bharat