Web Dynpro Text Translation using Assistance Class
One of the methods to translate text in Web Dynpro applications is using Assistance Class. In this Web Dynpro tutorial, I'll demonstrate a sample case where an assistance class is used for text translation on a Web Dynpro component.
Let's start by calling SE80 transaction in order to start ABAP Workbench.
Then open the Web Dynpro component you have created before.
Double click on Web Dynpro component and chage to Edit mode in the ABAP editor.
Click on the Assistance Class text area.
Enter a class name in the Assistance Class textbox. For example I used the name ZWD_BLCKORDERS_TXTCLS.
Click Save button. The ABAP Workbench will ask your permission to create the new assistance class.
The class ... does not exist
Create class?
Click Yes button in order to create assistance class for your Web Dynpro application.
After the Assistance Class is created within the Web Dynpro component double click on Assistance Class textbox where you have typed the name of the class.
Now we can use Assistance Class method IF_WD_COMPONENT_ASSISTANCE~GET_TEXT in order to read the translation of text elements within Web Dynpro ABAP codes.
In order to define text elements, follow the menu options : Goto > Text elements
When the text elements screen is displayed, change to Edit mode to define new text elements.
In this ABAP tutorial, I want to create text elements for radio buttons with Active, InActive and All options. Then we will translate these texts into different target languages.
You can create select options in WDDOINIT method of the MAIN view with following text elements: 011 Active, 012 Inactive, and 013 All
After you have defined the text elements you need for your Web Dynpro component, click Save and then Activate
Below is the ABAP code that Web Dynpro developers can use within the Main View WDDOINIT method source code
Now ABAP developers are ready to translate text into different target languages using Text Elements Translation menu. When you're displaying Assistance Class choose Goto > Translation from menu options.
Then press Enter to continue with next screen in SAP Text translation
As in text translations in ABAP reports, developers can maintain the translated text into the input text areas left empty for translation value.
As you can see the SAP system suggests translation values in the target system below the input text area.
You can choose the suggested text by double-click on the suggested translation text.
When you are finished with translation for text defined in the Web Dynpro Assistance Class, save your work and exit application.
When you test your SAP Web Dynpro application on a web browser, you can see that the page title is not translated which is actually the translation of Web Dynpro application description. If this is the case you can also translate Web Dynpro application title on web browser as illustrated in the referenced ABAP tutorial.
As last step, you should create a transport request for text translations in the target system in order to release your changes on test and productive SAP system. Please refer to ABAP tutorial Create Transport Request for Text Translations using RS_LXE_RECORD_TORDER for step by step implementation of exporting text translations into a transport request.