The user who sends an SAP ERP RFQ to SAP Sourcing is not always the owner of the RFx document. The owner can also be the user who created the RFx template. This template (or templates might have been created by an administrator, who by default becomes the owner of all documents that use this template (see my other post, “How to choose which RFx template in SAP Sourcing should be used?”). Of course, it is possible to add other users and groups as owner, but wouldn’t it be easier if the user who maintains the SAP ERP RFQ is also the owner of the Sourcing RFx document? While this is certainly an item in the SAP Sourcing/CLM backlog bucket, it is currently not available. However, I will present one possible workaround (I am sure there are other ways this can be done).
The idea is simple: make sure that the user ID is sent from SAP ERP through PI to SAP Sourcing, and then run a script which replaces the RFx owner with the user ID from ERP. One prerequisite for this approach is that the users are in sync between SAP ERP and SAP Sourcing (that is, the user IDs in both systems should be identical, otherwise the script needs to be adjusted accordingly). Another prerequisite is that the users have the required permission.
Another approach you could take (and skip any work in SAP ERP and SAP PI) is to create (user) groups in SAP Sourcing with the same ID as your Purchasing Groups. Then, run a script similar to the one described above to add this group as collaborators of the RFx document (note that it is not possible to change the owner of a RFx document to a (user) group, thus the owner might be a generic user).
Let’s start in SAP Sourcing by adding an extension field which retrieves the SAP ERP RFQ user ID.
Go to Setup and click at Extension Definition.
Select RFx and change to Edit mode.
Add an extension field of type String with an internal name like RFQUSER etc.
Save, and go back to Setup.
Go to Integrated Document Configuration and open the IDC for ERP.
Go to Excluded/Included Attribute List and click at rfx.RFXDoc (in Edit mode) and scroll down to where you should find the Included Extensions.
Make sure that the newly created field RFQUSER is selected to ensure that it is part of the generated XML file. Additionally, make sure (in Page Customization) that this field is read-only so that other users cannot change this field.
Now, we can add the script that we discussed earlier.
Go to Script Definition and create a new document.
Select Document Lifecycle Event and enter data similar to the shown in the figure below.
Set the class to RFx. You might want to select a specific Document Type, but this depends on your system configuration as different RFx templates with different document types can be configured.
Copy/enter the script at the end of this post. Note that the script is only an example, and you might want to adjust it depending on your requirements!
Before SAP PI mapping occurs, we need to make sure that the user ID is part of the IDoc. The data in the RFQ document is transformed into the IDoc ORDERS05. This IDoc (by default) will not contain the user name or user ID. However, the segment E1EDL37 has a field called ERMAN (Name of Person who created the Object) which can be used for this purpose. For example, use a user exit to populate this field with sy-uname.
In SAP PI, do the following:
Open the Enterprise Services Builder, select the PI Content (for example, E-Sourcing SRM Java Server OP 9.0), expand Data Types,and double-click DT_RFx_Header_Fields.
Change to Edit mode and insert a new element.
Enter the name RFQuser same like the extension field which we created before in Sourcing.
Save and activate the changes.
Then, navigate to Message Mappings and double-click at MM_ORDERS05_To_RFx.
Edit the message mapping by expanding the segment E1EDl37 and clicking ERNAM.
In the list on the right side, select the new field RFQUSER.
Connect it as shown in the figure below.
Save and activate the mapping.
// This script will set the document owner to the value of a string extension field RFQUSER.
// It generates an error if the value of the name is not found in the user account data.