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
532

Hi Guys,

Whats wrong in my select statement.,

SELECT lifnr

xblnr

bukrs

inv_date

invr_date

zterm

dmbtr

waers

kursf

status FROM zinv_reg INTO TABLE lt_reg

WHERE status EQ 'CL'

AND bukrs EQ p_ccode

OR ( lifnr EQ p_vendor OR lifnr EQ ' ' )

OR ( invr_date GE so_date-low and

invr_date LE so_date-high ).

Here I need to pick only records where the data in between so_date-low and so_date-high, but with this select statement it is picking all the records.,

Can and one tell me how to do it.,

Regards,

Line

5 REPLIES 5
Read only

Former Member
0 Likes
515

Hi,

Instead of using OR operator, use IN operator. Refer the syntax for it and use. Bcoz., of OR operator it is taking all records I suppose.

Reward if useful.

Read only

gopi_narendra
Active Contributor
0 Likes
515
SELECT lifnr
xblnr
bukrs
inv_date
invr_date
zterm
dmbtr
waers
kursf
status FROM zinv_reg INTO TABLE lt_reg
WHERE status EQ 'CL'
AND bukrs EQ p_ccode
AND ( lifnr EQ p_vendor OR lifnr EQ ' ' ) " change OR to AND
AND invr_date GE so_date-low " change OR to AND
AND invr_date LE so_date-high .

This should work.

Regards

Gopi

Read only

0 Likes
515

Hi

I changed the code accordingly But I am unable to get the output., No records are picking with the select statement now.

Regards,

Line

Read only

0 Likes
515

Hi Line ,

Please check my response to the same question you have posted in the other post.

Regards

Arun

Read only

0 Likes
515

Hi,

Try this

SELECT lifnr

xblnr

bukrs

inv_date

invr_date

zterm

dmbtr

waers

kursf

status FROM zinv_reg INTO TABLE lt_reg

WHERE status EQ 'CL'

AND bukrs EQ p_ccode

AND ( lifnr EQ p_vendor OR lifnr EQ ' ' ) " change OR to AND

AND invr_date in so_date

Regards,

Aruna