cancel
Showing results for 
Search instead for 
Did you mean: 

How to fetch future dated records in using LDB?

Former Member
0 Kudos

Hello Experts,

Can any one please let me know how to fetch future dated records using LDB's(PNP/PCH).

I am trying to fetching using LOOP...ENDLOOP.

LOOP AT P0000 INTO <LFS_P0000> WHERE  BEGDA GT SY-DATUM.

ENDLOOP.

Is there any alternate solution to fetch the records with having performance impact.

Share your thoughts.

Cheers,

KR

Accepted Solutions (0)

Answers (2)

Answers (2)

BK
Explorer
0 Kudos

Hi KR,

alternative you could select with ldb only the strictly required infotypes and get the "future" infotypes by using function module HR_READ_INFOTYPE.

Regards

Bernd

Former Member
0 Kudos

The LDB won't help you a bit for getting records with a Changed On Date = SY-DATUM.

I'm not clear on exactly what you are trying to get is it: 1. Infotypes changed as of SY-DATUM with a Future Date or 2. Infotypes changed Today or Infotypes with a Future Date changed anytime,

For either one you are going to have add logic for each Infotype to do a Select PERNR from PAXXXX Where AEDTM = SY-DATUM and BEGDA > SY-DATUM then load that into a table.  After you have finished selecting all qualified PERNRS then sort this table by PERNR and then do a Delete Adjacent Duplicates.  After this loop through your table of PERNRS and load PNPPERNR.   This should all be done before you do the GET PERNR.

Former Member
0 Kudos

The LDP is only going to load data for the date(s) no the Selection Screen.  You can code a loop statement like you have all day long and it will get you nothing.   To have the LDB load future dated Infotypes you would need to use the "Future As of Today" selection if you are using LDP PNPCE or "From Today" if you are using LDP PNP.  The all records with an effective date greater than today should be loaded.

Former Member
0 Kudos

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.