Optimization Process of Reading and Writing HR Master Data Through Buffer

Embed Size (px)

Citation preview

  • 8/13/2019 Optimization Process of Reading and Writing HR Master Data Through Buffer

    1/3

    Optimization process of reading & writing of SAP HR master datathrough buffers

    Note: Below screen shots are taken from SAP ERP ECC6.0 Version

    Problem:

    Generally programmers using SAP's function module HR_INFOTYPE_OPERATION orHR_MAINTAIN_MASTERDATA to update HR PA infotypes in a HR/Payroll ABAP program (conversion orinbound interface), usually encounter a performance problem and most of the time only inproduction. However, both of these functions have a better performance than call transaction.

    Solution:

    As both of the function modules are buffering the data and doing some EXPORT to memory. The result ofthis is that after a few hundred calls to HR_INFOTYPE_OPERATION or HR_MAINTAIN_MASTERDATA,the buffer gets big enough to impact the performance of the function module. After thousand of updateseach call will take many seconds and your ABAP program will be unusable.

    The solution is simple. Call the function module 'HR_PSBUFFER_INITIALIZE' to clear the buffer aftereach update.

    In SAP HR there are several buffers available:

    1. TBUFF -the buffer of PCLx (PCL1, PCL2, PCL3, and PCL4) cluster tables.

    2. PS Buffer -the buffer filled while reading or writing PAnnnn (nnnn: 0000-9999) table data usingstandard function modules.

    3. PRELP Buffer. The buffer used while reporting through PNP logical data base.

    1 - TBUFF

    TBUFF is the buffer used while reading data from PCLx (PCL1, PCL2, PCL3, and PCL4) cluster tables.The import export macros use a form that buffers the data when reading and writing. It can be clearedwith the RP-INIT-BUFFER macro (Table TRMAC).

    --- The RP-INIT-BUFFER macro coding from table TRMAC

  • 8/13/2019 Optimization Process of Reading and Writing HR Master Data Through Buffer

    2/3

    We can also use standard SAP function module HR_MX_CLEAR_PAYR_BUFFERS available within R/3SAP systems depending on your version and release level SAP.

    2 PS Buffer

    As already mentioned above PS Buffer is used when function module 'HR_INFOTYPE_OPERATION' iscalled for updating master data. Call the function module 'HR_PSBUFFER_INITIALIZE' to clear the bufferafter each update.

    When you are reading master data using function module 'HR_READ_INFOTYPE it uses the same bufferas above, can be cleared with function module HR_INITIALIZE_BUFFER.

    3 PRELP Buffer

    PRELP Buffer also called PNP Buffer. This buffer cannot be cleared, and usually it does not createproblems, because it is designed to work with huge amounts of data.

    It is important to know what buffer you are using.

    So in PNP programs you should not call functions that read the infotypes with the PS buffer or withanother buffer. Because you would break the buffer, causing delay in read.

    Best practice to read data when using PNP in program:

    1. Possibly with the TRMAC Macro RP-READ-INFOTYPE

    RP-READ-INFOTYPE A B C D E, where

    A corresponds to PERNR which describes for which personnel number you require records.

    B corresponds to INFOTYPE which describes from which infotype you require records.

  • 8/13/2019 Optimization Process of Reading and Writing HR Master Data Through Buffer

    3/3

    C corresponds to data structure of the declared infotype (internal table like P0000 for infotype0000) where all the records of the particular personnel number will be stored.

    D corresponds to Start date.

    E corresponds to End date.

    2. Call the subroutine read-infotype in program sapdbpnp by passing the necessary parameters asbelow.

    Example: PERFORM read-infotype(sapdbpnp) TABLES p0001 USING '00001010'

    '0001' '18000101' '99991231'.

    While in master data (PA30 and the like) you should use the PS buffer functions and forms. Just likePERFORM READ_INFOTYPE(SAPFP50P) USING...

    -- RP-READ-INFOTYPE macro from TRMAC