This is a second blog describing standard user management in SAP Multichannel Foundation for Utilities and Public sector. The enhancement options in user management OData services are explained here in details. If you need a higher level picture, please refer to the introduction blog on user management. This blog repeats information explained in the Administrator’s Guide for SAP Multichannel Foundation for Utilities and Public Sector. Please refer to it for more information.
The following enhancement areas will be explained (assuming SAP CRM is the leading system, the same changes can be executed on the SAP ERP side as well):
- User request extension
- User activation, reset password, and change password extension
- Email configuration
User Request Extension
In our standard OData models CRM_UTILITIES_UMC_URM and ERP_UTILITIES_UMC_URM, the UserRequest entity was extended with the following fields: Account ID, Business Agreement ID (Contract Account ID on ERP side), Date of Birth, Country ID, Region ID, City, Postal Code, Street, House Number and Room Number.
Custom fields can be added to the UserRequest entity in the OData models CRM_UTILITIES_UMC_URM and ERP_UTILITIES_UMC_URM. Custom fields are added to the metadata of the service after service regeneration. Then, the fields are provided as an input in the process of creating the User request, through the implementation of BAdI /IWBEP/BD_MGW_URM_VERIFICATION.
Steps for extending User Request
Step 1: Enhance the User request structure
User request structure /IWBEP/S_MGW_URM_USR_REQ_EXT can be enhanced and you can add your own fields.
As illustrated in the screenshot above, currently only standard structure is included. You could append another extended structure with your own fields.
Step 2: Extend the UserRequest entity in the model
Remark: /IWBEP/USERREQUESTMANAGEMENT parent service that we inherited to CRM_UTILITIES_UMC_URM and ERP_UTILITIES_UMC_URM is not extendable via SEGW, which means that it can only be extended by using the old way of SAP Gateway service: via Customizing and by implementing necessary changes on MPC and DPC classes.
So, let’s extend CRM_UTILITIES_UMC_URM OData service. You need to run transaction SE24 in the SAP CRM system:
- Inherit the class CL_CRM_IU_UMC_URM_MODEL to your own Z-class
- Redefine the method DEFINE( ).
- Inside the method DEFINE( ), first call super->define( ) and then define your own fields for the entity UserRequest using the metadata APIs. See example code in the standard method below.
- Save and Activate.
You need to map the property names in the service with the ABAP name for all fields, as illustrated above.
Step 3: Register the new model and service
On the SAP CRM system, the newly created model provider Z-class has to be maintained in the IMG node: SAP NetWeaver -> Gateway Service Enablement -> Backend OData Channel -> Service Development for Backend OData Channel -> Maintain Models.
- Provide a technical model name and version.
- Click on Create button.
- Provide the same model provider class that you just created and a relevant description. See the standard User Request Management Model on the screenshot below.
- Save. Click on Check Model button to check if the model is correct.
Now the service has to be registered in the IMG under node: SAP NetWeaver -> Gateway Service Enablement -> Backend OData Channel -> Service Development for Backend OData Channel -> Maintain Services.
- Provide Technical Service Name and Service Version.
- Click on Create button.
- Provide a description and Data Provider Class as /IWBEP/CL_MGW_URM_DATA. Click on Save.
- Click on Assign model to assign the model that was created in the registering model step.
Final step, you need to expose the service in SAP Gateway via transaction /IWFND/MAINT_SERVICES. Test it to see if you get a metadata of the service showing up.
If everything went well, all the extended fields are passed to the verification BAdI, which can be used to insert custom logic for user request validation. Further logic can be implemented in this BAdI through the IMG node (SAP NetWeaver -> Gateway Service Enablement -> Backend OData Channel -> User Management Setup -> Verify User Request).
User activation, reset password, and change password extension
The BAdI /IWBEP/BD_MGW_UM_USR_MANAGER is used during the processes of creating user, changing password, resetting password, unlocking user, updating user, etc. The implementation of the multichannel application re-uses the standard SAP Gateway class /IWBEP/CL_MGW_UM_USR_MGR_SUSR with redefined methods, i.e. CREATE_USER. For other user management functionalities such as change password, reset password etc., we are still using the methods provided by the standard SAP Gateway BAdI implementation. The reuse of the standard Gateway implementation happens in the class CL_MGW_UM_USR_MGR_SUSR_COPY. General path for user management enhancements:
IMG Path: SPRO −> SAP Customizing Implementation Guide −> SAP NetWeaver −> Gateway Service Enablement −> Backend OData Channel −> User Self Service Setup −> Implement User Management.
Create and Activate New Online User for Existed Customer
When the user clicks on the activation link in the notification email, a new online account is created. The users with identical generated user IDs are created on SAP Gateway, CRM and ERP systems. Newly created users on SAP CRM and ERP systems will be associated to a certain business partner.
The enhancement spot /IWBEP/ES_MGW_UM contains BAdI definition to manage the users. The BAdI /IWBEP/BD_MGW_UM_USR_MANAGER can be used to configure processes of user creation, password change, password reset, etc. Standard implementation at the end does the following:
There is no special logic in the method CHANGE_PASSWORD. The standard BAdI implementation for SAP Gateway is reused in the BAdI implementation for SAP Multichannel Foundation for Utilities and Public Sector. If the user is locked due to too many unsuccessful logon attempts, the user will be unlocked when the password is reset.
In the enhancement spot /IWBEP/ES_MGW_URM, the BAdI /IWBEP/BD_MGW_URM_NOTIFICATION is used to send emails to the user when a user is created or for reset password.
Enhancement Spot: /IWBEP/ES_MGW_URM
BAdI Definition: /IWBEP/BD_MGW_URM_NOTIFICATION
Enhancement Implementation: CRM_IU_UMC_URM
Implementation Class: CL_CRM_IU_UMC_URM_NOTIFICATION
SERVICE_DOCUMENT_NAME = CRM_UTILITIES_UMC_URM
SERVICE_DOCUMENT_NAMESPACE = /SAP/
SERVICE_DOCUMENT_VERSION = 0001
IMG Path: SPRO −> SAP Customizing Implementation Guide −> SAP NetWeaver −> Gateway Service Enablement −> Backend OData Channel −> User Self Service Setup −> Define Notification Process for User Request Management:
Steps to create Your Own BAdI Implementation
In case you want to use the standard notification agent to send email notifications but you want to customize the content or format:
- Inherit the class CL_CRM_IU_UMC_URM_NOTIFICATION into your Z-class.
- Redefine the COMPOSE method.
- Register the extended class as BAdI implementation in the IMG in the above mentioned enhancement spot.
This blog should be able to get you started when you come to the point of extension of standard user management. A lot of APIs and BAdIs are mentioned in this blog, so don’t forget to put external breakpoints to check when something is not working.