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: 

PROBLEM IN SELECT STATEMENT

Former Member
0 Kudos

HI FRNDS ..

I AM HAVING SOME ERRORS IN THE WHERE CLAUSE PLZ CORRECT IT

select DOCNO into t_DOCNO from J_1IEXCHDR

where exnum = gf_text and

status ne ( 'd' and 'r' and 'b' ).

PLZ HELP ME TO COLLECT VALU OF THE STATUS FILED WHER IT IS NOT EQUAL TO D, R AND B

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

select DOCNO into t_DOCNO from J_1IEXCHDR

where exnum = gf_text and

status ne 'd'

and status ne 'r'

and status ne 'b'.

endselect.

Rgds,

Prakash

<b>Please reward points if it helps</b>

6 REPLIES 6

Former Member
0 Kudos

select DOCNO into t_DOCNO from J_1IEXCHDR

where exnum = gf_text and

( status ne 'd' OR status ne 'r' status ne 'b' ).

OR

ranges : r_status for YOUR FIELD REFERENCE.

r_status-sign = 'E'.

r_status-option = 'EQ'.

r_status-low = 'D'. APPEND r_status

r_status-low = 'R'. APPEND r_status

r_status-low = 'B'. APPEND r_status

select DOCNO into t_DOCNO from J_1IEXCHDR

where exnum = gf_text and

status IN r_status.

-Kiran

*Please reward useful answers

0 Kudos

hi Rohit,

Use <b>Ranges</b> concept for the same

i.e,

<b>Ranges : r_ranges for your field reference.

r_ranges-sign = 'E'.
r_ranges-option = 'EQ'.
r_ranges-low = 'D'. 
append r_ranges.
r_ranges-low = 'R'. 
append r_ranges.
r_ranges-low = 'B'. 
append r_ranges.</b>

Regards,

Santosh

Former Member
0 Kudos

Use a RANGES variable for appending the status.

r_status-sign = 'E'.

r_status-option = 'EQ'.

r_status-low = 'D'.

append r_status.

Now use this in the select statement.

Regards,

Ravi

Former Member
0 Kudos

Hi,

select DOCNO into t_DOCNO from J_1IEXCHDR

where exnum = gf_text and

status ne 'd'

and status ne 'r'

and status ne 'b'.

endselect.

Rgds,

Prakash

<b>Please reward points if it helps</b>

Former Member
0 Kudos

Hi Rohit,

Consider this .


SELECT docno
       INTO t_docno FROM j_1iexchdr
       WHERE exnum = gf_text AND
       status NOT IN ( 'D' , 'R' , 'B' ).


ENDSELECT.

Regards,.

Arun Sambargi.

former_member188685
Active Contributor
0 Kudos
RANGES: R_STAT FOR J_1IEXCHDR-STATUS.
R_STAT-LOW = 'D'.
R_STAT-SIGN = 'I'.
R_STAT-OPTION = 'EQ'.
APPEND R_STAT.
CLEAR R_STAT.
R_STAT-LOW = 'R'.
R_STAT-SIGN = 'I'.
R_STAT-OPTION = 'EQ'.
APPEND R_STAT.
CLEAR R_STAT.

R_STAT-LOW = 'B'.
R_STAT-SIGN = 'I'.
R_STAT-OPTION = 'EQ'.
APPEND R_STAT.
CLEAR R_STAT.
DATA: T_DOCNO LIKE J_1IEXCHDR-DOCNO OCCURS 0 WITH HEADER LINE.
DATA: GF_TEXT LIKE J_1IEXCHDR-EXNUM.
SELECT  DOCNO INTO TABLE  T_DOCNO FROM J_1IEXCHDR
WHERE EXNUM = GF_TEXT
 AND
STATUS NOT IN R_STAT.

Try to use Ranges.

Regards

vijay