Professional Documents
Culture Documents
Applies to: SAP NetWeaver WebAS 7.00 or higher. Summary: A tool to easy translate OTR Texts in Web Dynpro ABAP Component.
Scope: The Online Text Repository (OTR) is a central storage location for texts, and services for editing and
administering these texts. In BSP applications, you can work with OTR and the ABAP Workbench provide a translation tool to translate the BSP pages and views. In Web Dynpro components every text that you insert in the layout of the views is saved in the system as an OTR text but there isn't a tool to easily translate all created text in the views. I have written a program to facilitate the translation of the OTR text created in view's layout of the web dynpro abap component.
Tool usage: When the program starts, select one or more web dynpro components that contain the view to
translate thought the search help , the source language and the destination language then execute it.
The program shows all views of the selected web dynpro component.
By clicking on "Translate" the translation screen (like the one used for translating BSP page) is shown. This screen is shown thought the function SOTR_API_WB_TRANSLATE.
Installation : To install the translation tool on your system copy the following tool in an SE38 program.
*&---------------------------------------------------------------------* *& Report ZSDN_WDY_OTR_EDITOR *& *&---------------------------------------------------------------------*
TYPES: BEGIN OF gsty_wd_out_tab, btn_01 TYPE c LENGTH 10, component_name TYPE wdy_component_name, view_name TYPE wdy_view_name, END OF gsty_wd_out_tab. TYPES: gtty_wd_out_tab TYPE TABLE OF gsty_wd_out_tab. TYPES: BEGIN OF gsty_wdy_cname_f4, component_name TYPE wdy_component_name, description TYPE wdy_md_description, END OF gsty_wdy_cname_f4.
********************************************************************** * CLASS lcl_handle_events DEFINITION ********************************************************************** * **********************************************************************
CLASS lcl_handle_events DEFINITION. PUBLIC SECTION. METHODS: on_link_click FOR EVENT link_click OF cl_salv_events_table IMPORTING row column. ENDCLASS. "lcl_handle_events DEFINITION
********************************************************************** * Global Data Declaration * **********************************************************************
SELECTION-SCREEN: BEGIN OF BLOCK b1. SELECT-OPTIONS: pcname FOR wdy_component-component_name OBLIGATORY. PARAMETERS: pslangu TYPE sylangu MATCHCODE OBJECT h_t002 OBLIGATORY. PARAMETERS: pdlangu TYPE sylangu MATCHCODE OBJECT h_t002 OBLIGATORY. SELECTION-SCREEN: END OF BLOCK b1.
********************************************************************** * SEARCH HELP * **********************************************************************
AT SELECTION-SCREEN ON VALUE-REQUEST FOR pcname-low. * Create Search Help DATA: lt_wdy_component TYPE TABLE OF gsty_wdy_cname_f4. FIELD-SYMBOLS:<lw_wdy_component> TYPE gsty_wdy_cname_f4. SELECT * INTO CORRESPONDING FIELDS OF TABLE lt_wdy_component FROM wdy_component WHERE component_name IN pcname.
LOOP AT lt_wdy_component ASSIGNING <lw_wdy_component>. SELECT SINGLE * INTO CORRESPONDING FIELDS OF <lw_wdy_component> FROM wdy_componentt WHERE langu = sy-langu AND component_name = <lw_wdy_component>-component_name. ENDLOOP. CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST' EXPORTING retfield = 'COMPONENT_NAME' dynprofield = 'PCNAME' dynpprog = sy-cprog dynpnr = sy-dynnr value_org = 'S' TABLES value_tab = lt_wdy_component.
********************************************************************** * Text Initialization * **********************************************************************
INITIALIZATION. %_pcname_%_app_%-text = 'WD Component Name'. %_pslangu_%_app_% = 'Source Language'. %_pdlangu_%_app_% = 'Destination Language'.
START-OF-SELECTION. DATA: gr_table TYPE REF TO cl_salv_table, gr_display TYPE REF TO cl_salv_display_settings, gr_functions TYPE REF TO cl_salv_functions, gr_events TYPE REF TO cl_salv_events_table, gr_columns TYPE REF TO cl_salv_columns_table, gr_column TYPE REF TO cl_salv_column_table, l_color TYPE lvc_s_colo. FIELD-SYMBOLS:<lw_wd_otr> TYPE gsty_wd_out_tab. SELECT * INTO CORRESPONDING FIELDS OF TABLE gt_wd_otr FROM wdy_view WHERE component_name IN pcname AND version = 'A' AND type = 'CL_WDY_MD_VIEW'. LOOP AT gt_wd_otr ASSIGNING <lw_wd_otr>. <lw_wd_otr>-btn_01 = 'Translate'. ENDLOOP. * Create ALV table cl_salv_table=>factory( IMPORTING r_salv_table = gr_table CHANGING t_table = gt_wd_otr ). * Set zebra layout gr_display = gr_table->get_display_settings( ). gr_display->set_striped_pattern( cl_salv_display_settings=>true ). * Display all standard function
gr_functions = gr_table->get_functions( ). gr_functions->set_all( abap_true ). * Set the column BTN_01 as a link to tranlate gr_columns = gr_table->get_columns( ). gr_column ?= gr_columns->get_column( 'BTN_01' ). l_color-col = '4'. l_color-int = '1'. l_color-inv = '0'. gr_column->set_color( l_color ). gr_column->set_cell_type( 5 ). * Set event hadler gr_events = gr_table->get_event( ). CREATE OBJECT go_event_handler. SET HANDLER go_event_handler->on_link_click FOR gr_events. * Set event hadler gr_table->display( ).
********************************************************************** * CLASS lcl_handle_events IMPLEMENTATION **********************************************************************
CLASS lcl_handle_events IMPLEMENTATION. METHOD on_link_click. DATA: l_object_name TYPE trobj_name. DATA: lw_wd_compview TYPE gsty_wd_out_tab. IF column = 'BTN_01'. READ TABLE gt_wd_otr INDEX row INTO lw_wd_compview. CONCATENATE lw_wd_compview-component_name '%' lw_wd_compview-view_name INTO l_object_name. CONDENSE l_object_name NO-GAPS. CALL FUNCTION 'SOTR_API_WB_TRANSLATE' EXPORTING source_langu = pslangu target_langu = pdlangu pgmid = 'LIMU' object = 'WDYV' obj_name = l_object_name EXCEPTIONS no_entry_found = 1 internal_error = 2 no_authorization = 3 error_in_context = 4 user_cancelled = 5 error_in_transport_request = 6 OTHERS = 7. IF sy-subrc <> 0. MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. ENDIF. ENDIF. ENDMETHOD. "on_single_click ENDCLASS. "lcl_handle_events IMPLEMENTATION "on_double_click
Procedure
You can create OTR alias texts in the following ways: By double-clicking on the OTR alias in the page editor By choosing the menu option Goto OTR from the BSP application Using transaction SOTR_EDIT
If you have not yet specified a packet name for the OTR alias in your BSP, the system automatically extends the prefix in the page as well as in the OTR. 3. Enter the required text up to a maximum length of 255 characters. 4. Enter the length of the text in the Maximum Length field. Always consider translation needs by entering a longer length than the text itself. If you do not enter a value in this field, the system stores the OTR alias in its current length.
5. To save the text choose Enter or Save. 6. If you do not want to change the text any more, you can also choose Release at this point.
If you release the text it will be released for translation. You cannot change released texts.
7. If the OTR text contains abbreviations or anything else that make translation difficult, once you
have pressed the Release button, the system sends a further popup where you can enter explanations or comments. Enter a comment and choose .
to create a
Integration
OTR objects are translated in transaction SE63_OTR. It enables you to call up text objects in a standard worklist that contains three nodes: OTR levels 1, 2, and 3. At this time, texts only exist for OTR level 1. You can also access text objects directly. To do so, call transaction SE63_OTR and choose Translation Short Texts or Translation Long Texts. Alternatively, you can enter the object types technical key directly in the command field. You can also access transaction SE63_OTR from transaction SE63. To do so, choose Translation OTR Objects. For more information on the translation transaction, see Quick Start for Translators.
Features
Search Options for Direct Access
If you use the Translation menu to access an OTR object type directly, the system displays a dialog box that provides you with various search options:
Search for a specific package Search for a text in the OTR Search for the logical OTR ID
Context Information
Context information is displayed in the lower section of the OTR translation editor or in a separate dialog box.
...
An up-to-date where-used list containing all the objects in which the OTR text occurs Existing translations into other languages Administrative information such as:
Alias Package Original language Translation level Created by Created on Object type Technical name
Editor Functions
OTR translation takes place in a separate editor with the following special functions:
The OTR long text editor includes pushbuttons that enable you to format your texts (bold, italics). The OTR long text editor includes special functions that enable you to edit long texts with HTML formats: ...
Display preview of source and target text as in browser Copy tags to target text (with or without source text)
Constraints
OTR texts are not included in the statistics. You have to call up an OTR worklist to find out if you have any OTR texts to translate.
See also:
Translating an OTR Short Text Translating an OTR Long Text Calling Up a Worklist for OTR Objects