Application Development 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: 

where condition range

Former Member
0 Kudos

Hi,

I am using the below code but the data is not selecting as per the where condition date range.it shows sy-subrc =4.

s_datum-option = 'EQ'.

s_datum-sign = 'I'.

s_datum-low = v_date.

s_datum-high = w_lastday.

append s_datum.

read table s_datum index 1.

SELECT * FROM VBRK INTO CORRESPONDING FIELDS OF TABLE I_VBRK

WHERE VKORG IN S_WERKS

AND FKDAT EQ S_DATUM.

In the above code the data is not selecting for s_datum.how to solve the issue.

Thanks,

Rajendra.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

use BT instead of EQ while building the range

s_datum-option = '<b>BT</b>'.

s_datum-sign = 'I'.

s_datum-low = v_date.

s_datum-high = w_lastday.

append s_datum.

Thanks,

Naren

6 REPLIES 6

Former Member
0 Kudos

Hi,

Use IN instead of EQ

SELECT * FROM VBRK INTO CORRESPONDING FIELDS OF TABLE I_VBRK

WHERE VKORG IN S_WERKS

AND FKDAT <b>IN</b> S_DATUM.

Thanks,

Naren

0 Kudos

Hi,

I tryed using in also still the sy-subrc is 4 only but i have the data in the vbrk table.

Thanks,

Rajendra.

0 Kudos

Oops, I overlooked another thing, you need to use BT as the option.

s_datum-option = 'BT'.

Regards,

Rich Heilman

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

You need to use the IN operator.



SELECT * FROM VBRK INTO CORRESPONDING FIELDS OF TABLE I_VBRK
WHERE VKORG IN S_WERKS
AND FKDAT IN S_DATUM. 

Regards,

Rich Heilman

0 Kudos

Also, no need for this statement.

read table s_datum index 1.

REgards,

Rich Heilman

Former Member
0 Kudos

Hi,

use BT instead of EQ while building the range

s_datum-option = '<b>BT</b>'.

s_datum-sign = 'I'.

s_datum-low = v_date.

s_datum-high = w_lastday.

append s_datum.

Thanks,

Naren