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

Doubt In a Select Query..

Former Member
0 Likes
1,262

Hi..

I have a Doubt in a simple Query from the table NAST.

My query is as follows:--

Select kappl

objky

kschl

parnr

parvw

nacha

vsztp

from nast into table vit_nast

where kappl = p_kappl

and kschl in s_kschl

and parnr in s_parnr

and nacha = p_nacha

and vsztp in s_vsztp.

Now I want to select all the NAST records which are either not processed (NAST-VSTAT = 0) or incompletely processed (NAST-VSTAT = 2)(the field in the table NAST is VSTAT which denotes the Processing status of message)

So Can I add both the conditions in the WHERE clause of the the above Select Query?

Is there any other optimised way I can do that?

Thanks

Hi..

I have a Doubt in a simple Query from the table NAST.

My query is as follows:--

Select kappl

objky

kschl

parnr

parvw

nacha

vsztp

from nast into table vit_nast

where kappl = p_kappl

and kschl in s_kschl

and parnr in s_parnr

and nacha = p_nacha

and vsztp in s_vsztp.

Now I want to select all the NAST records which are either not processed (NAST-VSTAT = 0) or incompletely processed (NAST-VSTAT = 2)(the field in the table NAST is VSTAT which denotes the Processing status of message)

So Can I add both the conditions in the WHERE clause of the the above Select Query?

Is there any other optimised way I can do that?

Thanks

8 REPLIES 8
Read only

Former Member
0 Likes
1,187

hi,

Select kappl

objky

kschl

parnr

parvw

nacha

vsztp

from nast into table vit_nast

where kappl = p_kappl

and kschl in s_kschl

and parnr in s_parnr

and nacha = p_nacha

and vsztp in s_vsztp

and (vstat = 0 or vstat = 2).

hope this helps,

keerthi.

Read only

0 Likes
1,187

Select kappl

objky

kschl

parnr

parvw

nacha

vsztp

from nast into table vit_nast

where kappl = p_kappl

and kschl in s_kschl

and parnr in s_parnr

and nacha = p_nacha

and vsztp in s_vsztp

and ( vstat = 0 or vstat = 2).

Read only

Former Member
0 Likes
1,187

u can add the condition to the qury like this

Select kappl

objky

kschl

parnr

parvw

nacha

vsztp

from nast into table vit_nast

where kappl = p_kappl

and kschl in s_kschl

and parnr in s_parnr

and nacha = p_nacha

and vsztp in s_vsztp.

<b>and ( VSTAT = 0 or VSTAT = 2 )</b>

Read only

0 Likes
1,187

do this way

Select kappl

objky

kschl

parnr

parvw

nacha

vsztp

from nast into table vit_nast

where kappl = p_kappl

and kschl in s_kschl

and parnr in s_parnr

and nacha = p_nacha

and vsztp in s_vsztp

and <b>( vstat = 0 or vstat = 2).</b>

Read only

Former Member
0 Likes
1,187

hi,

Select kappl

objky

kschl

parnr

parvw

nacha

vsztp

from nast into table vit_nast

where kappl = p_kappl

and kschl in s_kschl

and parnr in s_parnr

and nacha = p_nacha

and vsztp in s_vsztp

<b>and ( VSTAT = 0 0r VSTAT = 2 ).</b>

Read only

Former Member
0 Likes
1,187

Hi,

you can use OR in the WHERE claus eand specify both the conditions.

Regards,

Aswin

Read only

Former Member
0 Likes
1,187

hi subhash,

Select kappl

objky

kschl

parnr

parvw

nacha

vsztp

from nast into table vit_nast

where kappl = p_kappl

and kschl in s_kschl

and parnr in s_parnr

and nacha = p_nacha

and vsztp in s_vsztp.

and<b>( VSTAT = 0 or VSTAT = 2 )</b>

hope this helps,

priya.

Read only

Former Member
0 Likes
1,187
ranges: r_stat for nast-vstat.

r_stat-low = '0'.
r_stat-option = 'EQ'.
r_stat-sign = 'I'.
append r_stat.
clear r_stat.

r_stat-low = '2'.
r_stat-option = 'EQ'.
r_stat-sign = 'I'.
append r_stat.
clear r_stat.

Select kappl
objky
kschl
parnr
parvw
nacha
vsztp
from nast into table vit_nast
where kappl = p_kappl
and kschl in s_kschl
and parnr in s_parnr
and nacha = p_nacha
and vsztp in s_vsztp
<b>and vstat in r_stat.</b>

check this..

Regards

vijay