HR Enhancements with ‘PROVIDE’ ABAP statement
HR Enhancements with ‘PROVIDE’ ABAP statement
Summary
Enhancing HR Extractors in BW is not same as enhancing any other extractors in BW as HR tables are dealt with dates (begin date and end date) for each record
This article gives clear picture about enhancing HR Extractors with the ‘PROVIDE’ ABAP statement.
Introduction
Using PROVIDE statement the data is adjusted as per the begin dates and end dates during extraction of the HR data which is based on dates.
Scenario
Let’s take the 0EMPLOYEE_ATTR extractor as an example to be enhanced with the data from PA0007 (HR Master Record: Info type 0007 (Planned Working Time)) with the fields MOSTD (Monthly hours) and WOSTD (Hours per week).
Example
Let’s consider the below is the employee extract structure as an example. Now we want to enhance this with the fields MOSTD and WOSTD from PA0007 table.
0EMPLOYEE (extract structure as an example)
PA0007 table (taking just 2 fields as an example)
After enhancing the 0EMPLOYEE_ATTR the extract structure looks as below.
Generally, we write the program in EXIT_SAPLRSAP_002 as,
When ‘0EMPLOYEE_ATTR’.
LOOP AT I_T_DATA INTO Z_0CUST_SALES_ATTR.
ZTABIX = SY-TABIX.
select single * from PA007 into w_pa007
where employee = z_employee_attr-employee
and begin date = z_employee_attr-begin date
and end date = z_employee_attr -end date.
if sy-subrc = 0.
z_employee_attr -mostd = w_pa007-mostd.
z_employee_attr -wostd = w_pa007-wostd.
else.
clear: z_employee_attr –mostd, z_employee_attr -wostd
endif.
MODIFY I_T_DATA FROM z_employee_attr INDEX ZTABIX.
ENDLOOP.
When executed this will not fetch any data as the condition for the dates will not satisfy. And the output is as follows which is incorrect.
Even if we try to fetch the data based on condition of the dates this would not be correct as the employee has worked in two different hours at different periods.
Let’s try with the below statement.
select single * from PA007 into w_pa007
where employee = z_employee_attr-employee
and begin date > z_employee_attr-begin date
and end date < z_employee_attr -end date.
The below data fetched is incorrect as the employee has worked in two different hours at different periods and we are expected a split automatically.
Now, let’s come on to the actual way of doing to get the split by using provide statement.
Syntax:
PROVIDE { FIELDS {*|{compi}}
FROM itabj INTO waj VALID flagj
BOUNDS intlim1j AND intlim2j
[WHERE log_expj] }
BETWEEN extlim1 AND extlim2
[INCLUDING GAPS].
Get the data from PA0007
Select PERNR ENDDA BEGDA MOSTD WOSTD
from PA0007 into table it_pa0007
for all entries in l_t_employees where PERNR = l_t_employees-PERNR
Perform provide with the extracted data and the data from PA007
provide * from l_t_p0007
* from l_t_employee
between V_BEGDA and V_ENDDA.
move-corresponding: l_t_employees to z_employee_attr,
l_t_p0007 to z_employee_attr.
append Z_hrms_biw_io_occupancy to I_T_DATA.
Endprovide
Now the data from the extraction is as below which is adjusted according to the dates and is as expected.
Conclusion:
PROVIDE Statement is useful to adjust the data which is based on the dates and can be performed on multiple tables.
New NetWeaver Information at SAP.com
Very Helpfull