How to use the performance using Hashed Table?


Hashed table for single read access


Hashed table is used to access the internal table in a constant time. It increase the performance for reading the internal table.


We define select-options for taking input of personnel number.




Next, we define a type ty_payroll based on payroll infotype fields pernr and abrdt. 

A structure and a hashed table based on this type are also defined. 

The hashed table has a unique key pernr.



Similarly, an address type ty_address is defined, along with a structure and internal table.


We then write two select statements. 

The first reads PA0003 for all personnel numbers specified and the date of last payroll run (abrdt). 

The second select statement is used to read all the stras addresses corresponding to permanent
address type (subty = 1) valid at the system date.




Finally, a loop is run on the addresses internal table it_address. 

Within the loop, the read table statement is used for reading the payroll table it_payroll
(the hashed table) for each of the personnel number processed. 

Within the loop, the personnel number, abrdt date, and the address field stras are displayed.

We have used field symbols instead of work areas, in conjunction with loop and read statements for better performance.









No comments:

Post a Comment