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: 

Please answer this simple question: it plays an important role

Former Member
0 Kudos

How to write query to retreive the latest record by using PN-BEGDA , PN-ENDDA, SYDATUM,.

I know using RP-PROVIDE.......other method using query i require

it is urgent

1 ACCEPTED SOLUTION

amit_khare
Active Contributor
0 Kudos

Use this.

select * from PAnnnn where begda <= sy-datum

and endda >= sy-datum.

This will always return the records active on today's date.

Regards,

Amit

Reward all helpful replies.

4 REPLIES 4

amit_khare
Active Contributor
0 Kudos

Use this.

select * from PAnnnn where begda <= sy-datum

and endda >= sy-datum.

This will always return the records active on today's date.

Regards,

Amit

Reward all helpful replies.

Former Member
0 Kudos

Hi Ramana,

Good!

use the SELECT and ENDSELECT with the where conditoin.

Thanks,

Sunil

Former Member
0 Kudos

Hi,

Do you want to get the latest record based on BEGDA or ENDDA?

Below logic to get the latest record based on BEGDA.

SELECT * FROM PN

UP TO 1 ROWS

WHERE begda <= sy-daum

AND endda >= sy-daum

ORDER BY begda DESCENDING.

ENDSELECT.

Former Member
0 Kudos

Hi Ramana,

Try this one this will give the latest record in terms of time ok. sy-uzeit : display the current time ok..

data: time like sy-uzeit.

time = sy-uzeit + 80.

Here 80 is SECONDS OK..

select * from PAnnnn where begda = time.

Reward points if helpful

Kiran Kumar.G.A