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 query for date

Former Member
0 Likes
996

hi friends,

i am facing a problem with my slect statement. i need to get details greater than the date given in select stmt, but i'm not geting it. please do help me .

select ebeln

bsart

aedat

ernam

lifnr

from ekko

into table it_ekko

where ebeln eq ekko-ebeln

and aedat gt '20080424'

and bsart <> 'AN'

  • '20080424'

and frggr is null or frgsx is null or frgke eq '1'.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
760

Hi you are selecting the data from the ekko table and in ur where condition ur giving it as where ebeln = ekko-ebeln .

in ekko-ebeln there is no value this will not give you what u are looking for. Please check this out..

6 REPLIES 6
Read only

Former Member
0 Likes
760

hi

u can do 1 thing

data : dat type sy-datum.

dat = '20080424'.

select ebeln

bsart

aedat

ernam

lifnr

from ekko

into table it_ekko

where ebeln eq ekko-ebeln

and aedat gt dat

and bsart 'AN'

check whether it wrk.

with regards

Rohan Shetty

Read only

Sm1tje
Active Contributor
0 Likes
760

your are selecting and comparing from same table EKKO, this is not possible!!!!

where ebeln eq ekko-ebeln.

1. ekko-vbeln was previously filled in another select.

2. ekko-vbeln should be replaced by parameter or variable.

Edited by: Micky Oestreich on May 12, 2008 7:58 AM

Read only

Former Member
0 Likes
760

hi Kat,

do this way ..


data : v_date like ekko-aedat value '20080424'. 

select ebeln
bsart
aedat
ernam
lifnr
from ekko
into table it_ekko
where 
*ebeln eq ekko-ebeln
and aedat gt v_date
and bsart 'AN'
and ( frggr is null or 
        frgsx is null or 
        frgke eq '1' ) .

Regards,

santosh

Read only

Former Member
0 Likes
760

Micky Oestreich

is right

i think u have to check ur code

y r u using the same table again and again

even do my 1 ans is appropriate but goin to same table again n again is not appropriate

Edited by: Rohan Shetty on May 12, 2008 8:06 AM

Read only

Former Member
0 Likes
761

Hi you are selecting the data from the ekko table and in ur where condition ur giving it as where ebeln = ekko-ebeln .

in ekko-ebeln there is no value this will not give you what u are looking for. Please check this out..

Read only

Former Member
0 Likes
760

actually there is no need to use

ebeln eq ekko-ebeln in where clause

thank u friends,