Hi Richard,
Thanks for replying back.
Using below code snippet, i am able to fetch future dated records,i believe it will pick records whose BEGDA is greater than today.
LOOP AT P0000 INTO <LFS_P0000> WHERE BEGDA GT SY-DATUM.
ENDLOOP.
what if i need both Change date records and Future dated records in same selection and i want to use only PNP LDB? Irrespective of time period selection.
should i be using GET PERNR or GET PERAS
I am using PNP LDB.
I am trying to fetch change date records as on sy-datum and future dated dated records.
at selection screen - i might fetching using any of the standard selection screen options (Time Period,Company Code,
Personnel area,Payrollarea/pers.subarea combo).
i am trying to fetch as below
Case 1:
GET PERNR
loop at p0002 assigning <lfs_p0002> where aedtm eq sy-datum
and begda gt sy-datum.
wa_final-vorna = <lfs_p0002>-vorna.
endloop.
When try in above,i am able to fetch only future dated records if they have change date as sy-datum.
Case 2:
GET PERNR
loop at p0002 assigning <lfs_p0002> where aedtm eq sy-datum
or begda gt sy-datum.
wa_final-vorna = <lfs_p0002>-vorna.
endloop.
In case 2, say if i have changed in record in infotype P0002 more than 1 time or consider a record is having change date as sy-datum more than 10 times. Above loop runs for all records,which is wrong and will have huge performance impact as to get one record we are running loop for 10 times.
Case 3:
I haven't tried this yet...
GET PERNR.
sort p0002 by pernr ascending endda descending.
read table p0002 assigning <lfs_p0002> with key endda gt sy-datum
aedtm = sy-datumm
binary search.
if sy-subrc eq 0.
wa_final-vorna = p0002-vorna.
endif.
request you to share your inputs on this.....
Cheers,
KR.