Learn how to simulate organizational structure views for a future date by enhancing the standard function module to handle a key date. Otherwise the date is overwritten in standard reports such as a Flexible Employee Data report or custom reports that use the standard function module.
Key Concept
SAP-delivered function module RP_PNP_ORGSTRUCTURE or programs based on this function module do not read new Organizational Management (OM) objects created with a future date even if the Key Date field is used to run the program on a future date. An enhancement to the standard function module gives the ability to override standard system dates with a keyed-in future date.
Users often have the requirement to combine employee master data from Personnel Administration (PA) with Organizational Management (OM) data to simulate several organizational planning scenarios, but are not able to do so because the standard function module cannot read and display OM objects that are effective in the future. We have come up with a way to work around this limitation by enhancing the SAP standard function module RP_PNP_ORGSTRUCTURE to read and display the OM objects created in the SAP ERP HCM system to be effective at a future date. Using this method, you can overcome the handicap of not being able to simulate your organizational planning scenarios in combination with your existing standard PA reports or custom reports.
Organizational Changes Using Plan Versions
When organizations acquire new companies, merge subsidiaries, or revamp their organizational structure for any reason, management is presented with several what-if scenarios and needs to do some analysis to consider the various options for how best to restructure.
In the SAP ERP HCM system, the standard way of performing such what-if scenarios is to use comparisons of multiple plan versions of organizational structures, either copied from active versions of the organizational structures or created from scratch. Figure 1 shows a sample active version of an organizational structure that you can copy.

Figure 1
A sample of an active version organizational structure showing various functional units reporting to the organizational unit (SBU1)
As part of an organization-restructuring exercise, a planner needs to study the different impacts of various organizational structures in combination with PA data. In this scenario, planners often encounter a situation in which the organizational structures can be in multiple versions (e.g., Plan Version 01, Plan Version 02, and so on). As a result, obtaining PA data by making copies from the active version can be quite cumbersome. Also, in this scenario with multiple plan versions, standard reports from PA do not display OM objects with future effective dates without the enhancement we discuss in this article. By following the steps outlined, you can learn a simple way to work around this problem and streamline the organizational planning process to use PA data in a much easier way.
Organizational Changes in Active Versions of Organizational Structures
As part of the organization restructuring process, some organizations carry out changes to OM objects in their active version of the organizational structure if the changes are minimal or performed in a controlled environment. Although this method may not be in line with SAP-recommended standard OM planning processes, companies are sometimes willing to choose this option to avoid the risk of overwriting active objects with planning objects during iterative changes. This option also provides the advantage of being able to analyze new organizational structures with existing employee data (e.g., the ability to manipulate existing OM data along with new organizational structures). However, you are not able to analyze this newly created OM data using the new organizational structures if the OM data has an effective date that lies in the future.
Figures 2 to 4 show multiple versions of an organizational structure (reporting to SBU1) based on the active version 01 shown in Figure 1, with different functions excluded or included or where the reporting relationship is changed. Such changes are common in organizations. These figures depict what usually is done during the organizational planning process.

Figure 2
The Sales function is excluded from reporting to SBU1

Figure 3
The Back Office is excluded from reporting to SBU1, but Sales is included

Figure 4
The Back Office is excluded from reporting to SBU1, and Procurement is moved under Production
Problem Scenario
In any current active version of the OM structure, there are OM objects (e.g., a new organizational unit) that have been created, depending on the company’s requirements. Unless the system date is equal to or greater than the start date of that object, standard SAP ERP HCM PA reports such as a Flexible Employee Data report (transaction code S_AHR_61016362) do not allow you to select or display the new organizational unit in the pop-up screen (Figure 5). This is because the standard reports use function module RP_PNP_ORGSTRUCTURE and ignore the key date input given by the user in the initial selection screen of the report. Due to this, newly created organizational units with effective dates in the future are not displayed in the output. The same issue arises with any custom-developed PA reports, which in most cases use standard function module RP_PNP_ORGSTRUCTURE.

Figure 5
A standard Flexible Employee Data report with organizational structure selection
In this example, the standard SAP ERP HCM Flexible Employee Data report is executed with a Key Date of 24.04.2015, but the system date is less than the Key Date. So, in this case, the output does not display an Organizational Unit created with a Valid From date of 24.04.2015.
Whenever an organizational structure selection is triggered by the user, function module RP_PNP_ORGSTRUCTURE is executed to display the organizational structure. Irrespective of the future Key Date’s value (e.g., equal to or greater than the start date of the new organizational unit), if an OM object exists with a start date on the keyed-in future date, this pop-up screen (Figure 5) does not display the OM object. Hence, the Key Date value becomes irrelevant for newly created OM objects on a future date.
Note
If an existing OM object is created on a system date or in the past and
it’s changed with a new start date in the future, those objects are
displayed in the pop-up screen.
Function module RP_PNP_ORGSTRUCTURE reads the key date in the BEGDA field, but later ignores it and overrides it with the system date. When the program overrides it with system date, it ignores the selection of future effective OM objects. Figure 6 shows the function module without values to illustrate how the dates are read and what happens during run time.

Figure 6
Function module RP_PNP_ORGSTRUCTURE reads the BEGDA key date
The Solution to the Problem
Function module RP_PNP_ORGSTRUCTURE internally calls function module RH_TYPE_STRUC_GET_PARAMS, which is where the solution to the problem is contained. Function module RH_TYPE_STRUC_GET_PARAMS ignores the Key Date value and overrides it with the system date with BEGDA.
You can enhance this standard function module (e.g., RH_TYPE_STRUC_GET_PARAMS) using custom code in the enhancement spot (boxed in black), as shown in Figure 7.

Figure 7
Write the custom code in the function module
You can identify the source program that calls this function module in the active session (usually a custom report starting with Z*) or any standard PA report program, dynamically identified and passed by sy-cprog).
In Figure 8 the P_DATE brings the Key Date entered in the selection screen of the custom report. This code selects the input date from the selection screen of a custom report that calls the function module.

Figure 8
The date value from the selection screen of a custom report is read by the code
Next, the five lines of code in Figure 9 are added to refresh the tree view of the organizational structure based on the Key Date value. If this code is not included, newly created organizational units are not refreshed for display.

Figure 9
Add the code to refresh the new organizational structure
The seven lines of code in Figure 10 convert the overriding system date BEGDA and ENDDA values with the date keyed in by the user in the selection screen. When the system date is converted to a future date that is keyed in by the user, and the organizational structure is refreshed, all the OM objects that are valid on the future date are displayed.

Figure 10
The code that converts the system dates to valid future effective dates
Figure 11 shows an example of this scenario after these enhancements have been made. OM object record (unit 50002701) is created on 23.04.2015with a start date of 28.04.2015—an effective date in the future.

Figure 11
Table HRP1000 with a future effective OM object
When a custom report is run on any date before the start date of the object, the organizational unit selection displays the organizational unit in the pop-up window generated using standard function module RP_PNP_ORGSTRUCTURE. In this case, after enhancing the function module, the new pop-up window displays a NEW ORG UNIT FROM 28 APRIL (e.g., an effective date from 28.04.2015), shown in Figure 12.

Figure 12
A custom report with an As of Date of 28.04.2015
Enhance PA Custom Reports
If your organization uses standard OM planning tools with multiple versions of organizational structures, you can also enhance a PA custom report selection screen to input any version (plan or active) and handle it through function module RP_PNP_ORGSTRUCTURE to generate an organizational structure of a specific version. In this case, the PA enhancement spot must be modified to read the version input by the user. (This is beyond the scope of this article, so no code samples are provided to do this.)

Figure 13
Modify the report selection screen to select the Plan version to be read by the modified function module
Select the Plan version to be read by the modified function module that picks the appropriate version of the organizational structure plan for output. Here (in Figure 13) the report selection screen’s As of Date radio button is selected (for the date value 30.04.2015) and test Plan version 99 is selected. Click the Organizational Structure button. This displays the new organizational units created with a valid from date of 30.04.2015 in a pop-up screen (not shown).
Replicate the Enhancement in SAP Standard Reports
In this example, a standard Flexible Employee Data report (program RPLICO10) is executed to produce a similar result.
Making enhancements to function modules works for standard reports (such as a Flexible Employee Data report) to generate an organizational structure with new organizational units created with a start date lying in the future. Without using the enhancements discussed in this article, the Flexible Employee Data report does not display the future-dated OM objects shown in the pop-up screen in Figure 14.

Figure 14
A standard Flexible Employee Data report displaying a new organizational unit valid from date of 28.04.2015
Guruprasad Dasarathan
Guruprasad Dasarathan is an SAP ERP HCM Functional Consultant. He has 26 years of experience in HR Functional and 15 years of SAP ERP HCM consulting and system support experience. He has designed several SAP ERP HCM solutions around ABAP, BSP, Web Dynpro, Workflow, and Process Integration technologies, and architects his solutions around SAP standard building blocks and framework. Guruprasad currently works as a Senior Business Analyst – SAP HR, for Qatar Petroleum.
You may contact the author at guruzinbox@gmail.com.
If you have comments about this article or publication, or would like to submit an article idea, please contact the editor.

Shakeela Shibu
Shakeela Shibu is an SAP Technical Consultant. She has worked in SAP for over 12 years, mainly on HCM solutions across various technologies like ABAP, BSP, Web Dynpro ABAP/JAVA, Workflow, and SAP Gateway. Shakeela is currently working as a Senior Systems Engineer for Qatar Petroleum.
You may contact the author at shakeelashibu@gmail.com.
If you have comments about this article or publication, or would like to submit an article idea, please contact the editor.