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

Fetching latest record

Former Member
0 Likes
495

hi all,

can anyone tell me how to fetch the latest record from ldb for an employee .But i need to get the old record also if the contents inside two particular columns are different.

for eg.i should get only the 2nd record if p0014-lgart and p000-betrg same(latest one)

<u>p0000-pernr.......p000-vorna .......p0000-nachn.......p0014-lgart.....p0014-betrg</u>

1........................ x..........................y ...........................z..................9.00

1........................ x..........................d ...........................z..................9.00

but i should get all the records if it is like this

<u>p0000-pernr.......p000-vorna .......p0000-nachn.......p0014-lgart.....p0014-betrg</u>

1........................ x..........................y ...........................z..................9.00

1........................ x..........................d ...........................t...................9.00

1........................ x..........................d ...........................t...................5.00

1 ACCEPTED SOLUTION
Read only

amit_khare
Active Contributor
0 Likes
435

Normally we fetch the latest record by using macro RP_PROVIDE_FROM_LAST but for your requirement I will suggest to use SELECT and gett all the records for an employee in the date range in an internal table.

SORT in descending based on BEGDA.

Now use READ statement.

Read t_0015 into wa1 index 1.

read t_0015 into wa2 index 2. now compare required values in wa1 & wa2.

Regards,

Amit

Reward all helpful replies.

2 REPLIES 2
Read only

amit_khare
Active Contributor
0 Likes
436

Normally we fetch the latest record by using macro RP_PROVIDE_FROM_LAST but for your requirement I will suggest to use SELECT and gett all the records for an employee in the date range in an internal table.

SORT in descending based on BEGDA.

Now use READ statement.

Read t_0015 into wa1 index 1.

read t_0015 into wa2 index 2. now compare required values in wa1 & wa2.

Regards,

Amit

Reward all helpful replies.

Read only

0 Likes
435

hi Amit,

its working...thanku very much