‎2008 May 05 12:55 PM
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
‎2008 May 05 12:58 PM
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.
‎2008 May 05 1:06 PM
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
‎2008 May 05 1:09 PM
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
‎2008 May 05 1:39 PM
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
‎2008 May 05 1:45 PM
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