Spend Management Blogs by SAP
Stay current on SAP Ariba for direct and indirect spend, SAP Fieldglass for workforce management, and SAP Concur for travel and expense with blog posts by SAP.
Showing results for 
Search instead for 
Did you mean: 
Former Member

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.

  1. Go to Setup and click at Extension Definition.
  2. Select RFx and change to Edit mode.
  3. Add an extension field of type String with an internal name like RFQUSER etc.
  4. Save, and go back to Setup.
  5. Go to Integrated Document Configuration and open the IDC for ERP.
  6. 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.

  1. Go to Script Definition and create a new document.
  2. Select Document Lifecycle Event and enter data similar to the shown in the figure below.
  3. 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.
  4. 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:

  1. 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.
  2. Change to Edit mode and insert a new element.
  3. Enter the name RFQuser same like the extension field which we created before in Sourcing.
  4. Save and activate the changes.
  5. Then, navigate to Message Mappings and double-click at MM_ORDERS05_To_RFx.
  6. Edit the message mapping by expanding the segment E1EDl37 and clicking ERNAM.
  7. In the list on the right side, select the new field RFQUSER.
  8. Connect it as shown in the figure below.
  9. Save and activate the mapping.

Sample script:

// 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.

uaName = doc.getExtensionField("RFQUSER").get();

if (hasValue(uaName))

{    // See if this string is a valid user account

    userAccountHome = IBeanHomeLocator.lookup(session, doc.getDocumentOwnerUserReference());

    userAccountBean = userAccountHome.findByName(uaName);

        // Throw an error if the name is invalid

    if (!hasValue(userAccountBean))


        throw doc.createApplicationException("RFQUSER", "invalid name");




        // Set the owner in the RFx


                // Clear the name to avoid this code from being executed again