Application Development 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: 

Select query not working

Former Member
0 Kudos

Hi,

Im using this select query in my RFC:

select <field list> from but000 into table IT_but000 where type = '2' and partner in r_client.

Where r_client is a range having values for diffrent partners. Issue is when there is no value in r_client query is not returning any record. ideally it should return records based on condition "type = 2". can anybody help me in this.

Rgds

Sudhanshu

9 REPLIES 9

Former Member
0 Kudos

Hi,

When you are using the select query as you are using then the selection will be based on type = '2' and partner in r_client as you have given AND. Instead you can give an IF condition and check whether the r_client is not initial then use the select query

select <field list> from but000 into table IT_but000 where type = '2' and partner in r_client and in case id r_client is initial use select <field list> from but000 into table IT_but000 where type = '2'.

Regards,

Midhun

0 Kudos

Hi,

Infact that is my problem. I have 5 more fields in selection screen and can't just put so many IFs. ideally it should not consider r_client if there is no value in this and retieve records based on "type" only.

rgds

sudhanshu

0 Kudos

Hi

just check the type of r_client and the partner in the debug mode.

and also just give the select query as select <field list> from but000 into table IT_but000 where partner in r_client and type = '2'.

Regards,

Midhun

Former Member
0 Kudos

Hello,

How are you building the range table r_client?

Vikranth

0 Kudos

Hi,

Here is the way im using ranges:

ranges: r_client for BUT000-PARTNER.

r_client-sign = 'I'.

r_client-option = 'EQ'.

r_client-low = s_client_low.

r_client-high = s_client_high.

append r_client.

rgds

sudhanshu

0 Kudos

Hello,

May be you could do something like this and check,


ranges: r_client for BUT000-PARTNER.

if not s_client[] is initial.
r_client-sign = 'I'.
r_client-option = 'EQ'.
r_client-low = s_client_low.
r_client-high = s_client_high.
append r_client.
else.
r_client-sign = 'I'.
r_client-option = 'CP'.
r_client-low = '*'.
append r_client.
endif.

Vikranth

0 Kudos

Hi Sudhanshu,

You may try the following code.


ranges: r_client for BUT000-PARTNER.
If s_client[] is not initial.
r_client-sign    = 'I'.
r_client-option = 'EQ'.
r_client-low    = s_client-low.         "Hope you have put S_CLIENT-LOW instead of S_CLIENT_LOW
r_client-high   = s_client-high.
append r_client.
endif.

Hope this helps.

Thanks,

Ranjith

Former Member
0 Kudos

Hi

Just modify the querry as below.

select <field list> from but000 into table IT_but000 where type = '2' * or * partner in r_client.

Regards,

Pravin

Edited by: pravin s. on Mar 24, 2010 11:40 AM

Former Member
0 Kudos

Hi,

If s_client is your select-options in ur selection u can directly use that in query

whithout populating the range table (r_client). Code given below.

select <field list> from but000 into table IT_but000 where type = '2'

and partner in s_client. This will populate the itab.

Regards,

Rajeswari