Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member
8,160

OTR

The Online Text Repository (OTR) is a central storage location for texts, and services for editing and administering these texts. It first appeared with Business Server Pages in SAP 6.10.

Texts are cross-client workbench objects.

They can be maintained via SOTR_EDIT transaction, and from transactions of workbench object using OTR, which comprise:

· BSP application

· ABAP Object Class (exception texts)

· Enhancement Framework elements (Implementation, Spot, etc.)

· ICF service

· Web Dynpro elements (Application, Component, etc.)

· Transformation

They can be translated via SE63_OTR transaction.

They are stored in tables SOTR_HEAD and SOTR_TEXT.

Objective 

  • All the texts of Web Dynpro components are stored in OTR.
  • There is no tool available for mass translation of OTR’s.
  • Manual translation of OTR is very tedious process.
  • You have to translate OTR one by one using SOTR_EDIT or SE63 transaction.
  • To avoid this time consuming and drudgery work I have written BDC a program to facilitate the translation of the OTR texts in bulk. Using this program you can translate 1000 or more OTR’s in same time you need for translating a single OTR manually.

Tool usage

1. Create an excel Sheet containing the translation data in the following format.

          a.     Column 1  : Text in source language

          b.     Column 2  : Text in target  language

          c.     Column 3  : Length  of target text

          d.     Column 4  : alias for the OTR

    

2. Save the Excel sheet in Unicode text format.

 

3. Create a program ‘ZOTR_TRANSLATION’ and copy paste the below given code.

4. Execute the Program ‘ZOTR_TRANSLATION’.

           a. You can Use the program in  two ways

                    A. By Creating a Session.

                    B. By Call transaction.

          b. Call Transaction is more of an online transaction, it executes in the same work process.  Creating a session, allows you to put off the process to the background                    process, they are administrated via SM35. 

A.     CALL TRANSACTION METHOD

  • Give Processing mode as :

A: show all dynpros
E: show dynpro on error only
N: do not display dynpro

NOTE: While using the tool for the first time when OTR’s are not locked under Transport Use ‘E’

                Or ‘A’ processing modes only.

  • Enter the Update mode as :

S: synchronously

A: asynchronously

L: local  

  • Enter the filename, Source language and Target language.
  • Execute.

  • If the short log check box is not checked you will get the below screen of logs, which will give the status of all translations and the Transport where those translations are locked.

B.     GENERATE SESSION METHOD

          i. Give a session name.

          ii. Enter the filename, Source language and Target language.

          iii. Execute


          iv. Use transaction SM30 for processing the session.

         

Detailed Explanation of all Parameters on selection screen:

                Session name   : Session name of generated session

                User                    :    User for session in batch

                Keep session    :    Flag for retaining processed folders           

          '  ' = delete session if finished
         'X' = keep   session if finished

                Lock date                 :  Lock folder for processing until specified date

Processing Mode : The MODE addition determines the processing mode for batch input processing.

“A” Processing with display of screens

"E"            Display of screens only if an error occurs

"N"          Processing without display of screens. If a breakpoint is reached in one of the called transactions, processing is terminated with sy-subrc same as 1001. The field sy-msgty contains "S", sy-msgid contains "00", sy-msgno contains "344", sy-msgv1 contains "SAPMSSY3", and sy-msgv2 contains "0131".

"P"         Processing without display of the screens. If a breakpoint is reached in one of the called transactions, the system branches to the ABAP Debugger

Update Mode : The UPDATE addition determines the processing mode for batch input processing.

"A"           Asynchronous update. Updates of called programs are executed in the same way as if in the COMMIT WORK statement the AND WAIT addition was not specified.

"S"           Synchronous processing. Updates of the called programs are executed in the same way as if in the COMMIT WORK statement the AND WAIT addition had been specified.

"L"           Local update. Updates of the called program are executed in such a way as if the SET UPDATE TASK LOCAL statement had been executed in it.

                Error Session          : group name of error-session

                No data indicator    :   Indicator to identify the empty values

                Short log                  :    Indicator for log creation

            ' '  =  log all transactions
‘X'  =  no transaction logging

                Filename                  :    Name of the file containing translation data

                Source language     :   Source language

                Target language      : Target language

Program

  REPORT /deereag/zotr_translation NO STANDARD PAGE HEADING LINE-SIZE 255.


INCLUDE bdcrecx1.

SELECTION-SCREEN : BEGIN OF BLOCK b1 WITH FRAME.

PARAMETERS:
" File Name
p_fname 
TYPE string,
" Source language
p_s_lang
TYPE spras,
" Target language
p_t_lang
TYPE spras.

SELECTION-SCREEN : END OF BLOCK b1.

DATA: BEGIN OF record,
rad_t_001
(001),
slang_002
(002),
stext_003
(132),
g_dynp_0205_length_004
(003),
g_dynp_0205_text_005
(255),
slang_006
(002),
package_007
(030),
alias_008
(050),
objtype_009
(004),
g_dynp_0205_length_010
(003),
g_dynp_0205_text_011
(255),
slang_012
(002),
package_013
(030),
alias_014
(050),
objtype_015
(004),
g_dynp_0205_length_016
(003),
g_dynp_0205_text_017
(255),
END OF record.

TYPES :
BEGIN OF t_tab,
s_text
(60)   TYPE c,
t_text
(60)   TYPE c,
t_length
(3TYPE c,
alias
(60)    TYPE c,
END OF t_tab.

DATA:    BEGIN OF t_asml_line,
row     
TYPE kcd_ex_row_n,
col    
TYPE  kcd_ex_col_n,
value    TYPE char50,
END OF t_asml_line.

DATA  : i_tab       TYPE STANDARD TABLE OF t_tab,
i_tab_line 
TYPE t_tab,
l_file     
TYPE char128.
DATA : it_file      LIKE t_asml_line OCCURS 0 WITH HEADER LINE.
*** End generated data section ***

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_fname.
PERFORM f4_for_filename.

START-OF-SELECTION.

PERFORM upload_file.

PERFORM open_group.

LOOP AT i_tab INTO i_tab_line.

PERFORM bdc_dynpro      USING 'SAPLSOTR_EDIT' '0100'.

PERFORM bdc_field       USING 'BDC_CURSOR'
'G_DYNP_0100-STEXT'.

PERFORM bdc_field       USING 'BDC_OKCODE'
'=MAINTAIN'.

PERFORM bdc_field       USING 'G_DYNP_0100-RAD_T'
'X'.

PERFORM bdc_field       USING 'G_DYNP_0100-SLANG'
p_s_lang.

PERFORM bdc_field       USING 'G_DYNP_0100-STEXT'
i_tab_line
-s_text.

PERFORM bdc_field       USING 'G_DYNP_0100-ALIAS'
i_tab_line
-alias.

PERFORM bdc_dynpro      USING 'SAPLSOTR_EDIT' '0200'.

PERFORM bdc_field       USING 'BDC_OKCODE'
'=CNTXT_MAINTAIN'.

PERFORM bdc_field       USING 'BDC_CURSOR'
'G_DYNP_0205_LENGTH'.

PERFORM bdc_dynpro      USING 'SAPLSOTR_EDIT' '0105'.

PERFORM bdc_field       USING 'BDC_OKCODE'
'/ECANC'.

PERFORM bdc_field       USING 'BDC_CURSOR'
'G_DYNP_0105-COUNTRY'.

PERFORM bdc_dynpro      USING 'SAPLSOTR_EDIT' '0200'.

PERFORM bdc_field       USING 'BDC_OKCODE'
'=SAVE'.

PERFORM bdc_field       USING 'G_DYNP_0200-SLANG'
p_t_lang.

PERFORM bdc_field       USING 'G_DYNP_0200-ALIAS'
i_tab_line
-alias.

PERFORM bdc_field       USING 'BDC_CURSOR'
'G_DYNP_0205_TEXT'.

PERFORM bdc_field       USING 'G_DYNP_0205_LENGTH'
i_tab_line
-t_length.

PERFORM bdc_field       USING 'G_DYNP_0205_TEXT'
i_tab_line
-t_text.

PERFORM bdc_dynpro      USING 'SAPLSOTR_EDIT' '0200'.

PERFORM bdc_field       USING 'BDC_OKCODE'
'/ECANC'.

PERFORM bdc_field       USING 'BDC_CURSOR'
'G_DYNP_0200-SLANG'.

PERFORM bdc_field       USING 'G_DYNP_0200-SLANG'
p_t_lang.

PERFORM bdc_field       USING 'G_DYNP_0200-ALIAS'
i_tab_line
-alias.

PERFORM bdc_field       USING 'G_DYNP_0205_LENGTH'
i_tab_line
-t_length.

PERFORM bdc_field       USING 'G_DYNP_0205_TEXT'
i_tab_line
-t_text.

PERFORM bdc_transaction USING 'SOTR_EDIT'.

ENDLOOP.

PERFORM close_group.

*&---------------------------------------------------------------------*
*&      Form  F4_FOR_FILENAME
*&---------------------------------------------------------------------*
*       This subroutine is used  to get F4 help for filename
*----------------------------------------------------------------------*
*       No Interface Parameters
*----------------------------------------------------------------------*
FORM f4_for_filename .
DATA : l_file TYPE IBIPPARMS-PATH.

CALL FUNCTION 'F4_FILENAME'
EXPORTING
PROGRAM_NAME       
= SYST-CPROG
DYNPRO_NUMBER      
= SYST-DYNNR
FIELD_NAME         
= 'P_FNAME'
IMPORTING
FILE_NAME          
= l_file .

MOVE l_file TO p_fname.

ENDFORM.                    " F4_FOR_FILENAME
*&---------------------------------------------------------------------*
*&     Form  UPLOAD_FILE
*&---------------------------------------------------------------------*
*      This subroutine is used for uploading the Data
*----------------------------------------------------------------------*
*      No interface Parameters
*----------------------------------------------------------------------*
FORM upload_file .

CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename               
= p_fname
filetype               
= 'DAT'
has_field_separator    
= 'X'
TABLES
data_tab               
= i_tab
EXCEPTIONS
file_open_error        
= 1
file_read_error        
= 2
no_batch               
= 3
gui_refuse_filetransfer
= 4
invalid_type           
= 5
no_authority           
= 6
unknown_error          
= 7
bad_data_format        
= 8
header_not_allowed     
= 9
separator_not_allowed  
= 10
header_too_long        
= 11
unknown_dp_error       
= 12
access_denied          
= 13
dp_out_of_memory       
= 14
disk_full              
= 15
dp_timeout             
= 16
OTHERS                  = 17.
IF sy-subrc <> 0.
*     Implement suitable error handling here
ENDIF.

IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM.                   

5 Comments
Labels in this area