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 not working

Former Member
0 Likes
823

SELECT * FROM zstv_ekko_ekpo INTO CORRESPONDING FIELDS OF TABLE lt_poitems

UP TO lv_rec_to ROWS

WHERE ebeln IN lr_po_number

AND bsart IN lr_doc_type

AND loekz EQ space "not deleted

AND reswk IN lr_suppl_plant

AND bedat IN lr_post_date

AND matnr IN lr_material

AND werks IN lr_plant

AND lifnr IN lr_vendor

AND bednr IN lr_trackingno

AND elikz IN lr_deliv_compl_ind

AND frgke IN lr_approve_status

AND bsgru IN lr_order_reason

AND kdatb >= in_valid_date

AND kdate <= in_valid_date

ORDER BY (lv_order).

the above query is not working when I include kdatb >= in_valid_date AND kdate <= in_valid_date.

zstv_ekko_ekpo is the database view .

Thanks vinay

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
720

Use it like this

kdatb gt in_valid_date

kdate lt in_valid_date

5 REPLIES 5
Read only

Former Member
0 Likes
721

Use it like this

kdatb gt in_valid_date

kdate lt in_valid_date

Read only

Former Member
0 Likes
720

Hi Vinay,

After using this select stamt are you geting any error or ?

Read only

0 Likes
720

Thanks Guys , Its working , nothing was wrong with statement , My logic was wrong

Vinay Kolla

Read only

Former Member
0 Likes
720

Hi,

Use like this

kdatb GE in_valid_date

kdate LE in_valid_date

>= is GE,

<= is LE

Read only

Former Member
0 Likes
720

HI,

SELECT * FROM zstv_ekko_ekpo INTO CORRESPONDING FIELDS OF TABLE lt_poitems

UP TO lv_rec_to ROWS

WHERE ebeln IN lr_po_number

AND bsart IN lr_doc_type

AND loekz EQ space "not deleted

AND reswk IN lr_suppl_plant

AND bedat IN lr_post_date

AND matnr IN lr_material

AND werks IN lr_plant

AND lifnr IN lr_vendor

AND bednr IN lr_trackingno

AND elikz IN lr_deliv_compl_ind

AND frgke IN lr_approve_status

AND bsgru IN lr_order_reason

AND kdatb >= in_valid_date

AND kdate <= in_valid_date

ORDER BY (lv_order).

the above query is not working when I include kdatb >= in_valid_date AND kdate <= in_valid_date.

zstv_ekko_ekpo is the database view .

Try reversing the statement, Make it

KDATB <= in_valid_date

kdate >= in_valid_date.

As kdtab is the start of validity date it requires to be less than or equal to the current date. and kdate is end of validity date it should be greater than or equal to the given date.

Say for a particular records.

KDATE = 16/12/08

KDATB = 12/12/08

given_date = 13/12/08

Now

kdatb <= given_date (True)

and kdate >= given_date (True.

Hope it will help.

With best regards,

Navneet Chaubey