Optimization process of reading & writing of SAP HR master data through buffers

By Nishanth Kumar Reddy Chenchu, HCL Technologies

 

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

Problem:

Generally programmers using SAP's function module HR_INFOTYPE_OPERATION or HR_MAINTAIN_MASTERDATA to update HR PA infotypes in a HR/Payroll ABAP program (conversion or inbound interface), usually encounter a performance problem and most of the time only in production.  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 of this 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 updates each 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 after each update.  

In SAP HR there are several buffers available:

  1. TBUFF - the buffer of PCLx (PCL1, PCL2, PCL3, and PCL4) cluster tables.
  1. PS Buffer - the buffer filled while reading or writing PAnnnn (nnnn: 0000-9999) table data using standard function modules.
  1. 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 cleared with the RP-INIT-BUFFER macro (Table TRMAC).  

 

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

We can also use standard SAP function module HR_MX_CLEAR_PAYR_BUFFERS available within R/3 SAP 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' is called for updating master data. Call the function module 'HR_PSBUFFER_INITIALIZE' to clear the buffer after each update.

 

 

When you are reading master data using function module 'HR_READ_INFOTYPE it uses the same buffer as 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 create problems, 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 with another 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.

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

      D corresponds to Start date.

E corresponds to End date.  

  1. Call the subroutine read-infotype in program sapdbpnp by passing the necessary parameters as below.

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 like PERFORM READ_INFOTYPE(SAPFP50P) USING...  

-- RP-READ-INFOTYPE macro from TRMAC

Please send us your feedback/suggestions at webmaster@SAPTechnical.COM 

HomeContribute About Us Privacy Terms Of Use • Disclaimer • SafeCompanies: Advertise on SAPTechnical.COM | Post JobContact Us  

Graphic Design by Round the Bend Wizards

footer image footer image