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

Select Statement

Former Member
0 Likes
857

I am using ranges here,

Based on the ranges I have my select statement and I want to exclude everything in the ranges for PSTYV. But It is not excluding, rather it is selecting. I see 'ZTAP in my output.

Any suggestions,.

r_pstyv-sign = 'I'.

r_pstyv-option = 'EQ'.

r_pstyv-low = 'ZTAP'.

APPEND r_pstyv.

r_pstyv-low = 'ZCCR'.

APPEND r_pstyv.

SELECT vbrk~vbeln

vbrp~posnr

vbrp~uepos

vbrp~aupos

vbrk~kunrg

vbrk~kunag

vbrk~fkdat

vbrk~knumv

vbrp~fkimg

vbrp~netwr

vbrp~pstyv

vbrp~aubel

vbrp~matnr

vbrk~vkorg

vbrk~vtweg

vbrk~spart

INTO TABLE it1_vbrk

FROM vbrk

INNER JOIN vbrp

ON vbrkvbeln EQ vbrpvbeln

WHERE vbrk~vkorg EQ p_vkorg

AND vbrp~pstyv NE r_pstyv

AND vbrk~erdat IN s_erdat.

Thanks ain advance.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
779

Hi,

Try this..

IF <b>NOT it1_vbrk-pstyv IN r_pstyv</b>

  • if the pstyv is ZTAP and ZCCR then condition will be true..

ENDIF.

THanks,

Naren

6 REPLIES 6
Read only

Former Member
0 Likes
779

You need to use IN with the range r_pstyv in your where clause. If you are trying to exclude ZTAP and ZCCR you need to populate the range like this:

r_pstyv-sign = 'E'.

r_pstyv-option = 'EQ'.

r_pstyv-low = 'ZTAP'.

APPEND r_pstyv.

r_pstyv-low = 'ZCCR'.

APPEND r_pstyv.

Read only

Former Member
0 Likes
779

Hi,

Changes are marked in bold..

r_pstyv-sign = '<b>E</b>'.

r_pstyv-option = 'EQ'.

r_pstyv-low = 'ZTAP'.

APPEND r_pstyv.

r_pstyv-low = 'ZCCR'.

APPEND r_pstyv.

SELECT vbrk~vbeln

vbrp~posnr

vbrp~uepos

vbrp~aupos

vbrk~kunrg

vbrk~kunag

vbrk~fkdat

vbrk~knumv

vbrp~fkimg

vbrp~netwr

vbrp~pstyv

vbrp~aubel

vbrp~matnr

vbrk~vkorg

vbrk~vtweg

vbrk~spart

INTO TABLE it1_vbrk

FROM vbrk

INNER JOIN vbrp

ON vbrkvbeln EQ vbrpvbeln

WHERE vbrk~vkorg EQ p_vkorg

AND vbrp~pstyv <b>IN</b> r_pstyv

AND vbrk~erdat IN s_erdat.

Thanks,

Naren

Read only

0 Likes
779

Thanks everyone.

Shejal.

Read only

0 Likes
779

Friends, It solved my previous problem but has created another problem.

I was usinf this piece of code before but i dont want to erase it, but I dont want to be succesful any time.

But i see that this condition is succesful now.

IF it1_vbrk-pstyv EQ r_pstyv.

Any suggestions,

Shejal.

Read only

Former Member
0 Likes
780

Hi,

Try this..

IF <b>NOT it1_vbrk-pstyv IN r_pstyv</b>

  • if the pstyv is ZTAP and ZCCR then condition will be true..

ENDIF.

THanks,

Naren

Read only

0 Likes
779

Thanks,

It works.

Shejal Shetty.