Creating dynamic actions to update infotype 41 is a challenge due to the fact that any given date type can exist in any one of the twelve available positions on the infotype. For example, one personnel number might have date type ‘XY’ in position two while another personnel number has the same date type in position four. There is also the possibility of one personnel number already having the desired date type while another is missing it. Because of this very real possibility of variation, a dynamic action to update infotype 41 cannot be configured using commands regarding explicit positions for the date types.
So now the question becomes how can a dynamic action be written to update infotype 41. The solution requires using ABAP form routines to determine the existing positions of the date types already stored on the current infotype 41 records and additional routines to either update an existing value or create a new date type entirely. The below dynamic action (Fig 1) is configured to update infotype 41 with the help of the custom ABAP form routines.
The form SET_CURRENT_DATES must be called prior to any routines that attempt to create/update a date type. This routine selects the current infotype 41 record and builds an internal table based on structure RP50D (GT_RP50D) where each date type/date combination on 41 is its own table row. The row on the table corresponds to its current position on the infotype. Because all the form routines exist within the same program all the subsequent form routines will have access to the data that gets populated to the internal table. An example exists below (Fig 2 and Fig 3).
The next step is to call forms to update or possibly insert new date types. In our example dynamic action above, we can see it calling form routine SET_40. The code in this form attempts to find date type 40 in table GT_RP50D. If found, it simply updates the DATE1 field to the value of PSPAR-BEGDA. If not found it would append a new entry to table GT_RP50D with FIELD1 = 40 and DATE1 = PSPAR-BEGDA. So, in our example above, if PSPAR-BEGDA was equal to 04/01/2013 then the DATE1 field would be updated to 20130401 on table GT_RP50D. We are also calling form routine SET_K2 in the example. Because it does not exist in GT_RP50D, a new entry would be created for it. The resulting internal table would look as below after all the forms in the example dynamic action are called. (F5 – all changes/inserts in red):
At this point table GT_RP50D contains the final value for all the date types/dates that we desire to have updated. All that’s left to do is map the values from internal table GT_RP50D back to their positions on infotype 41 within the dynamic action’s configuration. Form NEXT_DATE will be called 12 times, once for each infotype 41 date type/date position. The first time form NEXT_DATE is called it reads internal table GT_RP50D with the index of 1 and advances a counter by 1. The resulting value is then moved to P0041-DAR01 / P0041-DAT01 in the dynamic action’s config. Each subsequent call of form NEXT_DATE reads the next entry on table GT_RP50D by using the counter and the next entry of P0041-DARXX / P0041-DATXX is set to the values returned.
We have now successfully updated an infotype 41 record. The position of the date types or even their existence does not matter with the above methodology.
ABOUT HR FOCAL POINT
- When time, accuracy and high-quality support are essential, HR Focal Point's precision approach to SAP HCM solutions is the clear choice.
- HR Focal Point has been the SAP HCM expert since 2004 with hundreds of years of combined consulting experience its team.
- HR Focal Point has the SAP HCM experts that will allow you to achieve your goals on time, on point and on budget, thus maximizing your ROI.
- HR Focal Point offers a flexible engagement model so you only pay for the services you require, when you require them.
- As an SAP Services Partner, HR Focal Point is known for delivering high-quality solutions, in support of SAP HCM, that are completed accurately and on schedule.
- HR Focal Point has partnered with SuccessFactors to develop and deliver innovative Cloud solutions, including Employee Central Payroll, for their clients.
FOR MORE INFORMATION
HR Focal Point
Telephone: +1 855.464.4737