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: 

How can i fetch in a provide-endprovide the entries with the highest SEQNR?

Former Member
0 Kudos

Hi people,

My problem is that I need to select over an infotype of SAP HR. But I just want the last information valid, meaning the entries which have the last SEQNR (000, 001, 002 and so on). Usually there is only SEQNR = 000, but sometimes you can find bigger numbers here. This is an automatic field. I just want to fetch the last one.

But I am using a logical database (PNP) and a provide-endprovide statement.

What can I do for making it in an optimal way? Any hint?

Points will be rewarded for sure.

Regards. Elena

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Usually when U use LDB's (PNP in your case)

say :

infotypes : 0006.

start-of-selection.

GET PERNR. * after this statement P0006 will be filled

*now U can sort this structure P0006 ..

sort P0006 by pernr seqnr descending.

*now P0006 will have the highest seqnr ...

  • your coding ...

end-of-selection.

4 REPLIES 4

Former Member
0 Kudos

Usually when U use LDB's (PNP in your case)

say :

infotypes : 0006.

start-of-selection.

GET PERNR. * after this statement P0006 will be filled

*now U can sort this structure P0006 ..

sort P0006 by pernr seqnr descending.

*now P0006 will have the highest seqnr ...

  • your coding ...

end-of-selection.

former_member184119
Active Contributor
0 Kudos

write: the statmenet

rp_provide_from_last p0006 space pn-begda pn-endda.

Hope this will solve your problem.

Regards

sas

Former Member
0 Kudos

Hi,

Check the below code.

tables: pernr.

infotypes : 0001.

start-of-selection.

GET PERNR.

sort P0001 by begda descending seqnr descending.

end-of-selection.

Former Member
0 Kudos

Thanks everybody for your fast and helpful response!! I could solve my problem very easily using the sort before and doing some additional checks inside provide-endprovide.

Kind regards.