Skip to Content

Position to Position Based Substitution for SAP HR

Abbreviations I’m going to use:

EP           Enterprise Portal

UWL      Universal Work List

P2P        Position To Position

ECC        Enterprise Core Components

CRM      Customer Relationship Managment


About this blog

This blog will provide an overview of how to achieve Position to Position based substitution.  We will not be including every single piece of code to achieve this; it will be up to you to build your own components based on your own requirements.


What is substitution

When an employee goes on leave they can substitute another employee(s) to take control of their workflow work items for the time they are away. 


Situation Example

Although substitution is available as User to User based via the UWL independent of what SAP System you have (ECC, CRM etc), we will be dealing with Position to Position based substitution in a HR environment.

To set the scene for this blog we will be using this situation:

“Manager has gone on leave and Employee A are substituting into the Manager’s position to action work items on behalf of the Manager”

We want to provide P2P based substitutions i.e. create the relationships A210/B210 between the Manager’s Position and Employee A’s Position objects in the HR System.

Employee A will then be able to logon to the EP and access the Manager’s work items via the UWL.


Further Reading

Chris Solomon has provided an excellent blog that should provide a sound functional overview of the concepts of Substitution

MSS: Delegation….the final frontier?


SAP Help Document (there are plenty more)


In the IMG of your HR System you can also access the following IMG documents:

SAP NetWeaver->Application Server->Business Management->SAP Business Workflow->Basic Settings

  • Maintain Task Classes
  • Substitute Profile



Levels of Substitution

You need to define what type of substitution you want to implement based on your own requirements.  More often than not, user to user based substitution will suffice however there are of course times when this is not sufficient, an example is Public Sector customers who have a complex organisational structure including relationships such as “Higher Duties” (A081) where you want to capture all holders of the position being substituted for by simply passing the Position HR Object around (e.g. putting SXXXXXXXX into a workflow task as an agent and have all holders access the work item).

Here is how we have defined the levels of substitution:

User to User

User ID is directly related to another SAP User ID via table HRUS_D2.   There are number of ways which I’ve seen this implemented, some via ABAP program, Web Dynpro and more commonly this functionality is provided via UWL i.e. when you click on “Manage Substitution Rules”

 Manage Substitution Rules UWL Link

This is also common outside of HR systems as there is no concept of “Person” object.

Person to Position

Employee (Person Object type “P”) related to a Position via table HRVPADD2 and by maintaining the relationships in tableHRP1001.  To get this to work you can follow the approach adopted in this blog for P2P based substitution.

Position to Position (P2P)

Position (Object type “S”) related to another Position (Object type “S”) via table HRVPADD2 and by maintaining the relationships in tableHRP1001.

The aim of this blog is to show you that we can provide this type of substitution in the HR System.


P2P Supported in SAP Business Workplace (Transaction SBWP)

NB: P2P based substitution actually works if you are accessing work items in the backend system via transaction SBWP.

If this is sufficient for your requirements then you don’t have to proceed with the below example which includes an enhancement to SAP standard code.


P2P Not Supported in UWL

SAP does not support P2P based substitution as standard for UWL access to work items.  If you want proof of this please have a look at the following class->method:


Note the following lines of code:

*—- we only support personal substitution
  DELETE lt_swwwlhead WHERE otype <> ‘US’ AND otype <> space.

This is deleting any work item views that are not User based (object type “US”).  You may or may not have tried to put in P2P substitution relationships only to find that it doesn’t work in the UWL.  This is the culprit.

If we want P2P substitution to work, this is the place where we can make an Implicit Enhancement or Over-Write Exit on the method GET_WORKLIST.


Getting Started

I’ll run through how we achieved P2P based substitution at a customer site.  This is not meant to be the “only” solution to this problem, I hope SAP provides this type of Substitution as standard in the future as it is quite powerful.

This is what we did:

  • Created an ABAP Web Dynpro to allow the end user to create/change/delete  the substitution relationships (A210 / B210) and act as the entry point via the EP


  • Created some support functions / methods to update / change / create your Substitutions in table HRVPADD2


  • Create the Implicit Enhancement of class CL_SWN_UWL_WORKLIST method GET_WORKLIST to override the deletion of non-user based UWL views.


ABAP Web Dynpro

Our ABAP Web Dynpro which is executed in the EP looks like this:

 A Demo ABAP Web Dynpro

This allows the Manager to create the Substitution relationships (A210 / B210) between their own Position and the Employee’s position.

The requirements for this Web Dynpro were only make this available to managers via MSS.  Of course you can build a similar application and provide it to whom ever you want.

Use your imagination here, there is obviously some Position search and selection routines etc to assist the user with selecting a substitute position.



Update Methods

We created a set of common methods to handle the creation, change, activation of substitution relationships.  There are a number of interesting Function Modules we used to do this.

Have a look at Function Group RHW1 and RHW2:












These are really handy Function Modules and a number of these are sufficient to achieve what you want to do.  They will manipulate the data in table HRVPADD2.

Table HRVPADD2 is write protected so you cannot use direct inserts, modify, deletes in you customer namespace programs.


Relationship Overview

For P2P substitution to work, you need to create relationships between the two Position objects (Object type “S”).

To do this manually you can use transaction PO13.

Here are some screen shots of how the relationships look in our demo:

The Manager Position

  Show relationship in transaction PO13


Additional Data

You will notice a button on the top called “Additional data”.  This provides further data on the relationship.  For substitution these details are stored in the HRVPADD2 table.  Below is a screen shot of the Additional data screen:



The Employee Position

If you now look at the Employee’s position and the Substitution relationship you will notice the relationship will be A210.


Creating these relationships

We handle the creation of these relationships including the creation of the above  “Additional data” through program code.  Although you can create these relationships manually via transaction PO13, you can create them via your ABAP Web Dynpro / other code.


Substitute Profile

We won’t go into to much detail about Profiles, there are plenty of help documents about this.  For our requirements we only needed to use Substitution Profile “ALL”. 

In the “Further Reading” section of this blog we’ve listed some further links to help you understand these concepts more.


Substitution Active

In order for the substitution relationships to work, this MUST be “ticked”. 

We have used Function Module RH_SUBSTITUTION_MAINTAIN to manage this data as it provides with the ability to modify the “Substitution Profile”.


Implicit Enhancement

We also modified the method CL_SWN_UWL_WORKLIST->GET_WORKLIST with an implicit enhancement.  You can do this with an overwrite exit if you wish.

This method will compile a list of work items for the user and apply any substitution views, that is if you have applied User to User based substitution rules via the EP (shown above) by using the “Manage Substitution Rules” function, this method will read the HRUS_D2 table and identify if the substitution is active and incorporate the substituted users work items as well.

As stated in the code, SAP only support User based substitution so the method will delete any other substitution rules such as P2P based.

All we are looking to do here is copy the entire standard SAP method and remove the lines that delete any other UWL view, i.e. remove or comment out:

*—- we only support personal substitution
  DELETE lt_swwwlhead WHERE otype <> ‘US’ AND otype <> space.


Security Considerations

If you are going to create the A210 / B210 relationships in program code, you may (or may not) run into structural authorisation errors (we did).

Originally we were using a call to Function Module RH_RELATION_MAINTAIN which does not allow you to turn of authorisation checks. 

Security requirements are different from customer to customer.  In our case we wanted the Manager to allow a position for another Organisation Unit to be allowed to substitute which means we have to be able to get around structural authorisation checks. 
In hindsight RH_RELATION_MAINTAIN was an inappropriate Function Module to use instead we chose to use:


This allowed us to switch of authorisation checks.

It’s also important to manage who is being substituted, be mindful of their roles and responsibilities (think PFCG roles).  In our case we have limited Managers as eligible substitutes therefore we assume some similarities with PFCG roles when a Manager substitutes for another Manager.


Evaluation Paths

We did not do anything special for evaluation paths i.e. we did not modify A210, B210 evaluation paths.

However, because you are using P2P based substitution, you may need to consider how additional holders of a position will be picked up as Agents of a work item.

In our example we were required to ensure that “Higher Duties” relationships were taken into consideration (this is the A081 relationship) as a “Holder” of a Position when we pass the Position object itself into workflow as an Agent.


Expiry Dates

You will notice that entries in table HRVPADD2 have a BEGDA, ENNDA (begin date and end date). 

When the clock ticks over the end date, the substitution relationship will be invalid.

In our example, Employee A will no longer see the Manager’s work items after the end date so there is nothing explicit we had to do for this to end apart from calling RH_CUT_INFTY_1001_EXT if the Manager deletes the substitution in the ABAP Web Dynpro.


Historical Records

We have seen some posts regarding tracking of previous substitution’s.  Because entries in table HRVPADD2 have a date range (i.e. BEGDA and ENDDA) it is possible to keep records that are “Inactive” and create further substitution rules between different date ranges.

I haven’t looked  but I can’t see whether there is any standard reporting around this, however this would be a fairly simple report to build if you wanted to.

Other useful bits of information

As per the User to User based substitution via the “Manage Substitution Rules” function in the UWL, once the P2P based substitution is active you will then have access to this nice little piece of functionality located just above the tab-panel of the UWL:



The user will be able to switch between “My Items”, ”All Items” or “Items on Behalf Of”.  This functionality is provided as standard with the UWL (fantastic!).

Note that your UWL iView in the EP will have some settings for Substitution.  Ask your Portal consultant / Administrator to assist you with getting these setup in accordance with your requirements. 

These settings affect the way the end user can create / maintain their user to user based Substitution rules (stored in table HRUS_D2).


NB: In the image above we have changed the name of the iView “Universal Worklist” to “Inbox”


Pit falls of this approach


  • CL_SWN_UWL_WORKLIST->GET_WORKLIST, by creating an implicit enhancement, this method is now subject to your normal change request approval process and will not be subject to changes made in subsequent support packs.   Will probably have to me managed via SPAU if your system is being upgraded / patched.


  • If you create the ABAP Web Dynpro, you will have another development to support (I want to use the term TCO here but I won’t.. oops I just did)




P2P based substitution is a very effective way of providing substitutions for work items in a SAP HR System especially if your workflow strategy is to use position objects as Agents of work items in Workflow.

At this point in time I don’t know if SAP will support P2P based substitution as standard, they have provided User to User based substitution as standard and this may suffice for the majority of customers.

In any case, if your requirements are to use P2P based substitution this blog should hopefully get you on your way to achieving it.  As stated at the start this is not the only solution to this problem, you may find a more elegant way to do this and would be happily open to suggestions.

You must be Logged on to comment or reply to a post.
  • Wow! You covered this in great detail (but not overly done). I laughed because when I saw this, the first thing I thought was “structural authorizations?” and sure enough, it was there. I guess as I read, you have been through that pain (haha). Great blog overall and thanks for sharing. One question…and NOT to complicate this…did you put in workflow for approvals in place?(ie. approving the substitution is allowed) Maybe if the positions were at a certain level or higher or something like that? Just curious.

    And thanks for the mention of my blog as well. Glad someone reads them (haha).

    • Hey Chris, thanks for the reply and glad you enjoyed sharing my pain.

      No we didn’t workflow approval of Substitution.  It’s just for Manager’s (i.e. Manager can only subtitute another Manager) and there was a certain level of trust assumed by the business.

      Having said that, off the top of my head it would be fairly easy to do, thinking along the lines of ZCL_SWF_SUBSTITUION (with interface IF_WORKFLOW) with the relationships details etc on the object, workflow it off with an approval task and auto-update in the workflow if approved (easy?)

      I can see structurals being a problem in HCM Forms & Processes framework in this regard (i.e. IT1001 decoupled infotype fw classes) but for custom approval tasks where the actual DB updates are done by Workflow-Batch, structurals shouldn’t present an issue.

      Great to finally meet you on SCN, have been following your blogs for some time now 🙂

  • I ran into a similar situation in the beginning of 2007 for a client in europe, it was a global project and I ended up designing something very similar to your blog, the exception being we did consider structural profiles and put in logic for assigning the structural profile also along with the relationship creation… and then we did not have the complexity of higher duties et al…

    On a more flippant side: If you guys keep writing about all the stuff which am planning on writing I will be forced to renounce my keyboard mate 🙂
    There is this kiwi-mate of mine who went and wrote a book on hcm and got it published by SAP press,… a while ago,. then you did this here.. and I dont even want to talk about Chris Solomon bloke 🙂

    Lastly Good on you mate… really nice blog.


    • Thanks Shree,

      You’ve gotta get in first with the Blogs I think, Chris Solomon is an excellent blogger, there have been times when I’ve wanted to blog stuff about HCM Forms & Processes and low and behold, Chris has got there first :)..

      I was motivated to do this blog because I read through a heap of posts on SDN and couldn’t find anything that addressed a solution.  Half baked solutions are even ok, but couldn’t even find that!

      Again thanks for your positive comments mate,

      Take care,