Using OTR text contexts to adapt texts in the SAP CRM Web UI
Recently we performed a enhancement package upgrade of the SAP CRM system of a customer form EhP0 to EhP3. During the implementation of the system numerous OTR texts were changed by the implementation partner to adapt the texts visible in the Web UI. For example, the text “Account” was changed to “Geschäftspartner” (i.e. German for business partner) across the system. After the upgrade all these OTR texts where reset again to the SAP standard. As result, the OTR text needed to be changed again. In this process I started looking for a better solution that would not require changing OTR texts after each upgrade.
While there are quite a view blogs related to OTR texts and SAP CRM Web UI I couldn’t really find a solution for the problem. The best practices for SAP CRM Web UI on the SCN (Best Practices for SAP CRM Web UI Customization – CRM – SCN Wiki) also only states that SAP standard texts should not be changed. Through some playing around with the OTR transaction I finally found a nice solution within the SAP standard which I’d like to share here. The basic idea is to create a custom context for the OTR and use this context to adapt the necessary OTR texts.
Creating a custom context
In order to create a custom context one needs to implement the BAdI BTFR_CONTEXT. This BAdI consist of a single method CUSTOMER_CONTEXT that returns the custom context for the OTR. Below is the code of the simple implementation of this BAdI that I created. Note that I have used the |-operator to created the two strings that are returned from this method which is only available in the ABAP application server 7.40 and above.
METHOD if_ex_btfr_context~customer_context. customer_context-country = |DE|. customer_context-extension = |FACTUR|. ENDMETHOD
.After implementing the BAdI BTFR_CONTEXT and activating it the custom context is immediately available. To check this open transaction SOTR_EDIT and choose the menu “Edit -> Context -> System Context”.
This opens a pop up displaying the custom system context for OTR texts. If everything worked the country and extension that are set in the BAdI are displayed.
Creating OTR texts in the custom context
The next step is to create custom OTR texts in the custom context. As an example I’ll use the view DetailAccount in the UI component IUICMD. This view contains a button with the label “Account bestätigen” (if the log on language is german).
The label for this button is stored in the OTR in the package CRM_IU_IC_6X_MD and is available via the alias CRM_IU_IC_6X_MD/CONFIRMBP.
To create a custom text open transaction SOTR_EDIT, enter CRM_IU_IC_6X_MD/CONFIRMBP as the alias value an choose the menu “Edit -> Context -> Create”.
In the next step the system asks for the context in which the text should be created. The custom context provided by the BAdI implementation is already suggested.
The next screen is already populated with the SAP standard values of the OTR text CRM_IU_IC_6X_MD/CONFIRMBP. Except the context is set to the custom context that was selected in the pop up (in this case the context provided by the BAdI implementation). Now we can change the default text “Account bestätigen” to the custom text “Geschäftspartner bestätigen” and save the new context.
In order to add the new value to a transport request, click the transport icon.
After saving the entry select “Edit -> Context -> Overview” to display an overview of the contexts available to this OTR text. The overview shows text values for different context. In this case the default context as well as the one that was just created.
As a final step the OTR buffer needs to be reset using the transaction code /$OTR. After restarting the SAP CRM Web UI the label for the button is changed to the new text.
Custom contexts and upgrade
Using this approach, the OTR text will not be overwritten in a future system upgrade. However, the system context will be reset in an upgrade. Therefore, the system context needs to be set to the custom context after an upgrade. This can be done in the transaction SOTR_EDIT via the menu “Edit -> Context -> Adjust”.
Issues adjusting system context
In a recent CRM EhP4 upgrade project the approach described above did not reliable set the system context. Although I never found out why the system context can also be adjusted using the report SOTR_DEFAULT_CONTEXT_FLAG_SET. After executing this report the correct system context was used again.