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: 

Want select query to use Key Field in where clause with ranges

Former Member
0 Kudos

Hi,

Hi,

I need to use the ranges in the where clause.

I have performance issue in the select query so I want to use the key field of the table AFRu-RUECK

In where clause using Ranges..so that it will select all the ranges...

Select Single rueck

rmzhl

iedd

aufnr

stokz

stzhl

from afru into table et_afru

where

aufnr = i_aufnr and

stokz = space and

stzhl = 0.

Can anybody help me with the syntax...

Regards,

Kittu

6 REPLIES 6

former_member188829
Active Contributor
0 Kudos

Hi,

Example:

Ranges:R_rueck for AFRu-RUECK.
Select Single rueck
rmzhl 
iedd
aufnr
stokz
stzhl
from afru into table et_afru 
where 
rueck in r_rueck and
aufnr = i_aufnr and
stokz = space and
stzhl = 0.

0 Kudos

Hi,

hope these will not use...

try to check the index for where condition fields..and try to force by using index hints..

Example:


  Data :R_rueck TYPE RANGE OF AFRu-RUECK,   "add this
          R_RMZHL TYPE RANGE OF  AFRu-RMZHL. "add this

 Select Single rueck
 rmzhl 
 iedd
 aufnr
 stokz
 stzhl
 from afru into table et_afru 
 where 
 rueck in r_rueck and       "add this
RMZHL in r_RMZHL       "add this
 aufnr = i_aufnr and
 stokz = space and
 stzhl = 0.

Prabhudas

0 Kudos

Hi Vishnu,

Thank you for your quick response!

So does it mean that R_rueck will contain the lower and higher range of the values in it..?

I mean will it be filled automatically with the values....

Regards,

Kittu

0 Kudos

yes..

if nothing is mentioned in select options or ranges ..default it will take all values..

0 Kudos

Hi Kittu,

If you want to Pass the lower and higher values to the ranges use below code.(Like filling the select-options).

Example:

  r_rueck-sign   = 'I'.
  r_rueck-option = 'BT'.
  r_rueck-low    = '0000013578'.
  r_rueck-high   = '0000014000'.
  APPEND r_rueck.
  CLEAR  r_rueck.

If you are not passing any values to ranges,it will take all vaues.

Former Member
0 Kudos

Hello,

Thank you very much for your quick response!

I appreciate all your suggestion!

Regards,

Kittu