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

OR Condition

Former Member
0 Likes
595

Hi all,

Can anybody tell me, how to put 'or' condition

in abap code.

if i_vbrk[] is not initial .

select knumv kschl mwsk1 kwert

from konv

into corresponding fields of table i_konv

for all entries in i_vbrk

where knumv = i_vbrk-knumv

and where kschl = 'jin1' or kschl = 'jin6'.

endif.

Definitely rewards pts.

Regards,

Aastha

5 REPLIES 5
Read only

Former Member
0 Likes
571

Not sure excatly where you wanted the or, but you code looked wrong and was corrected here


IF i_vbrk[] IS NOT INITIAL .
  SELECT knumv kschl mwsk1 kwert
    FROM konv
    INTO CORRESPONDING FIELDS OF TABLE i_konv
    FOR ALL ENTRIES IN i_vbrk
    WHERE knumv = i_vbrk-knumv
      AND ( KSCHL = 'JIN1' OR kschl = 'jin6' ).

ENDIF.

Read only

Former Member
0 Likes
571

hi you can use this type of quries for or condition.

select knumv kschl mwsk1 kwert

from konv

into corresponding fields of table lt_tab

for all entries in lt_tab

where knumv = lt_tab-knumv

and kschl = 'jin1' or kschl = 'jin6'.

select knumv kschl mwsk1 kwert

from konv

into corresponding fields of table lt_tab

for all entries in lt_tab

where knumv = lt_tab-knumv

and kschl in ('jin1','jin6').

reward if useful

Read only

Former Member
0 Likes
571

Hi Gupta,

data : i_vbrk like vbrk occurs 0.

data i_konv like konv occurs 0.

if not i_vbrk[] is initial .

select knumv kschl mwsk1 kwert

from konv

into corresponding fields of table i_konv

for all entries in i_vbrk

where knumv = i_vbrk-knumv

and ( kschl = 'jin1' or kschl = 'jin6' ).

endif.

give reward if useful.

Regards,

Narasimha

Read only

Former Member
0 Likes
571

Hi ,

The way to write 'and' and 'or' in where condition is:

where knumv = i_vbrk-knumv

and ( kschl = 'jin1' or kschl = 'jin6' ).

I think its helpful to u.

Regards,

Swatantra Pathak

Read only

Former Member
0 Likes
571

Hi Aastha,

if i_vbrk[] is not initial .

select knumv kschl mwsk1 kwert

from konv

into corresponding fields of table i_konv

for all entries in i_vbrk

where knumv = i_vbrk-knumv

and where kschl = 'jin1' or kschl = 'jin6'.

The below code can be rewritten as

if i_vbrk[] is not initial .
select knumv kschl mwsk1 kwert
from konv
into corresponding fields of table i_konv
for all entries in i_vbrk
where knumv = i_vbrk-knumv 
and  kschl in ( 'jin1' , 'jin6' ) .

The statement is efficient and yeilds good performance also.

Pls reward if useful.

Thanks,

Sirisha.

Edited by: Sirisha Vadlamani on May 5, 2008 2:47 PM