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: 

whats wrong in this select query

Former Member
0 Kudos
139

Hi,

Im using below select query to fetch records:

SELECT <fld_list> INTO TABLE <itab>

industry between s_vert_low AND s_vert_high.

but it is not giving me any record.

rgds

sudhanshu

Moderator message: please use a more meaningful subject line next time.

Edited by: Thomas Zloch on Mar 25, 2010 3:06 PM

1 ACCEPTED SOLUTION

Former Member
0 Kudos
103

better question might be "what's right with this query?"...Answer ...we'll skip that....

Is fld_list populated?

I assume that the dereferencing for <itab> is correct...

What table are you selecting from? No 'WHERE'? Try something like this:

select <fld_list> from <database table> into table <itab>
  where industry ge s_vert_low AND industry le s_vert_high. 

But, why are you doing dynamic field list into dynamic table without a dynamic where clause?

6 REPLIES 6

Former Member
0 Kudos
103

Hi,

populate s_vert_low , s_vert_high into a range ....

s_vert-sign = 'I'.

s_vert-option = 'BT'.

s_vert-low = s_vert_low.

s_vert-high = s_vert_high.

append s_vert.

and write as below .....

SELECT <fld_list> INTO TABLE <itab>

industry in s_vert.

Regards,

Srini.

Former Member
0 Kudos
104

better question might be "what's right with this query?"...Answer ...we'll skip that....

Is fld_list populated?

I assume that the dereferencing for <itab> is correct...

What table are you selecting from? No 'WHERE'? Try something like this:

select <fld_list> from <database table> into table <itab>
  where industry ge s_vert_low AND industry le s_vert_high. 

But, why are you doing dynamic field list into dynamic table without a dynamic where clause?

0 Kudos
103

yes... you are right. i didn't post it well. My query is like this:

SELECT <fld_list> from BUT000 INTO TABLE <itab> where

industry between s_vert_low AND s_vert_high.

I have taken ranges also but if s_vert_high is blank it is not giving me any record. any input?

rgds

sudhanshu

0 Kudos
103

hi

first check the ranges low and high then append th ranges internal table.

Check Ranges low and high initial then append it.

Check the example code.

IF NOT s_vert-low  IS INITIAL AND NOT s_vert-high  IS INITIAL.
           s_vert-sign     = 'I'.
           s_vert--option = 'BT'.
           s_vert--low      = s_vert-low .
          s_vert--high     = s_vert-low .
    APPEND s_vert.
  ELSEIF NOT s_vert-low IS INITIAL AND s_vert-high  IS INITIAL.
          s_vert-sign     = 'I'.
           s_vert-option = 'EQ'.
          s_vert-low      = s_vert_low.
     APPEND gr_po_dte.
  ELSEif s_vert-high IS INITIAL AND s_vert-high  IS INITIAL  .
         s_vert-sign     = 'I'.
         s_vert--option = 'CP'.
         s_vert--low      = '*'.
    APPEND gr_po_dte.
    CLEAR: gr_po_dte.
  ENDIF.

0 Kudos
103

seems it will work. Thanks Dharmraj. I still have to do certain things in this and will update accordingly.

Rgds

sudhanshu

Former Member
0 Kudos
103

do like

SELECT <fld_list> INTO TABLE <itab>

where industry GE s_vert_low AND INDUSTRY LE s_vert_high.