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

LOOGIC NEEDED

Former Member
0 Likes
881

select single * from aufk where aufnr = zmm_isslip-aufnr and

werks = zmm_isslip-werks AND AUART BETWEEN 'PM01' And 'PM07'.

IS THIS THE CORRECT WAY TO USE BEWTEEN

pLZ GUIDE

1 ACCEPTED SOLUTION
Read only

former_member156446
Active Contributor
0 Likes
855

If I were you I would create a range for the Order type and use that.

ranges: ra_auart for vbap-auart.

MOVE 'I' TO ra_auart-sign.
MOVE 'EQ' TO ra_auart-option.
MOVE 'PM01' TO ra_auart-low.
APPEND ra_auart.
MOVE 'PM07' TO ra_auart-low.
APPEND ra_auart.
CLEAR ra_auart.


select single * from aufk 
where aufnr = zmm_isslip-aufnr and
werks = zmm_isslip-werks AND 
AUART in ra_aurat.

or


select single * from aufk
where aufnr = zmm_isslip-aufnr and
werks = zmm_isslip-werks AND
AUART IN ('PM01' , 'PM07').

7 REPLIES 7
Read only

Former Member
0 Likes
855

instead of this you should write

select single * from aufk where aufnr = zmm_isslip-aufnr and

werks = zmm_isslip-werks

AND AUART GT 'PM01' And AUART LT 'PM07'.

plz reward if useful

keep rockin

vivek

Read only

Former Member
0 Likes
855

hi,

Select single is to be used when only one unique record has to be picked from the database table.

Also in the query

select single * from aufk where aufnr = zmm_isslip-aufnr and

werks = zmm_isslip-werks AND AUART BETWEEN 'PM01' And 'PM07'.

YES Between can be used this way.

Its not clear whether you are using header or body of the table.

If you are using header then your query will work with ADDITION INTO wa(WORK AREA).

Read only

former_member156446
Active Contributor
0 Likes
856

If I were you I would create a range for the Order type and use that.

ranges: ra_auart for vbap-auart.

MOVE 'I' TO ra_auart-sign.
MOVE 'EQ' TO ra_auart-option.
MOVE 'PM01' TO ra_auart-low.
APPEND ra_auart.
MOVE 'PM07' TO ra_auart-low.
APPEND ra_auart.
CLEAR ra_auart.


select single * from aufk 
where aufnr = zmm_isslip-aufnr and
werks = zmm_isslip-werks AND 
AUART in ra_aurat.

or


select single * from aufk
where aufnr = zmm_isslip-aufnr and
werks = zmm_isslip-werks AND
AUART IN ('PM01' , 'PM07').

Read only

0 Likes
855

ERROR MESSAGE

The IN operator with "RA_AURAT" is followed neither by an internal table nor by a value list.

PLZ GUIDE

Read only

Former Member
0 Likes
855

Hi,

Instead of between Use,

select single * from aufk

where aufnr = zmm_isslip-aufnr and

werks = zmm_isslip-werks AND

AUART IN 'PM01' And 'PM07'.

Don't forget to reward if useful...

Read only

Former Member
0 Likes
855

hi,

select single * from aufk where

aufnr = zmm_isslip-aufnr and

werks = zmm_isslip-werks and

AUART IN ('PM01' , 'PM07').

here in works like between. it takes the ranges from Pm01 to pm07.

Read only

Former Member
0 Likes
855

Hi Abhut,

I believe the query that you have writeen should work fine.

Example of using In between.

This expression is true if the content of the column col lies (not) between the values of data objects dobj1 and dobj2 (interval limits enclosed). You can define no column descriptor for the interval limits.

E.g.

SELECT carrid connid fldate

FROM sflight

INTO CORRESPONDING FIELDS OF TABLE sflight_tab

WHERE fldate BETWEEN sy-datum AND date.

Jayant Sahu