on 10-08-2003 3:33 PM
Hello,
the translations of texts are realized in our company by external translators, which have no access to our systems. It would be nice to have a tool, which extracts all OTR's from a package
into a file, i.e. XML. On the other side it should be possible to import such a XML-File after
the translation process.
Is it planned to offer such a tool?
Best regards.
Hello Stefan,
please tell me your email. I will send you a Z-Program to export and import your OTR Texts.
Best regards.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
enclosed example-sourcecode for OTR Export and Import.
I hope it help you.
Best regards
Hubert
EXPORT *************************************************
*&----
*
*& Include ZOTREXPORTTOP Modulpool *
*& *
*&----
*
PROGRAM ZOTREXPORT .
*----
interne Tabelle für Errorlog----
*
TYPES: BEGIN OF sotr_rec,
paket type sotr_head-paket,
alias_name type sotr_head-alias_name,
sotr_text type sotr_text-text,
END OF sotr_rec.
data: it_sotr type table of sotr_rec.
*&----
*
*& Modulpool ZOTREXPORT *
*& *
*&----
*
*& *
*& *
*&----
*
INCLUDE zotrexporttop . " global Data
INCLUDE ZOTREXPORTO01 . " PBO-Modules *
INCLUDE ZOTREXPORTI01 . " PAI-Modules *
INCLUDE ZOTREXPORTF01 . " FORM-Routines *
SELECTION-SCREEN: BEGIN OF BLOCK sel01.
PARAMETER: p_paket TYPE sotr_head-paket OBLIGATORY DEFAULT 'ZINTERNET',
p_langu TYPE sotr_text-langu DEFAULT sy-langu,
p_tistam type SYSTTSTUT,
p_path TYPE rlgrap-filename DEFAULT
'
xxxxxxxxxxxxxxxxotrtext.txt'.
SELECTION-SCREEN: END OF BLOCK sel01.
DATA: path TYPE string.
SELECT sotr_head~paket
sotr_head~alias_name
sotr_text~text
INTO TABLE it_sotr
FROM sotr_text
INNER JOIN sotr_head
ON sotr_textconcept = sotr_headconcept
WHERE sotr_head~paket = p_paket AND
( sotr_head~chan_tstut >= p_tistam or
sotr_head~crea_tstut >= p_tistam ) and
sotr_text~langu = p_langu.
sort it_sotr by alias_name.
path = p_path.
CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING
BIN_FILESIZE =
filename = path
filetype = 'ASC'
APPEND = SPACE
WRITE_FIELD_SEPARATOR = SPACE
HEADER = '00'
TRUNC_TRAILING_BLANKS = SPACE
WRITE_LF = 'X'
COL_SELECT = SPACE
COL_SELECT_MASK = SPACE
DAT_MODE = SPACE
CONFIRM_OVERWRITE = SPACE
NO_AUTH_CHECK = SPACE
CODEPAGE = SPACE
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
WRITE_BOM = SPACE
IMPORTING
FILELENGTH =
CHANGING
data_tab = it_sotr
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
NOT_SUPPORTED_BY_GUI = 22
ERROR_NO_GUI = 23
others = 24
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
IMPORT *************************************************
*&----
*
& Include ZOTRIMPORTTOP Report ZOT
*& *
*&----
*
REPORT ZOTRIMPORT message-id zk .
TYPES:
BEGIN OF import_rec,
paket type sotr_head-paket,
filler,
alias_name type sotr_head-alias_name,
sotr_text_d type sotr_text-text,
sotr_text_fsp type string,
END OF import_rec.
data:
it_import type standard table of import_rec,
it_source type standard table of sotr_text,
it_target type standard table of sotr_text,
w_import type import_rec,
w_source like sotr_text,
w_target like sotr_text,
anz type i,
concept like sotr_head-concept,
length type i,
path type string,
source_context type SOTR_CNTXT,
text_fsp type sotr_text-text.
*&----
*
*& Report ZOTRIMPORT *
*& *
*&----
*
*& *
*& *
*&----
*
INCLUDE zotrimporttop . " global Data
INCLUDE ZOTRIMPORTO01 . " PBO-Modules *
INCLUDE ZOTRIMPORTI01 . " PAI-Modules *
INCLUDE ZOTRIMPORTF01 . " FORM-Routines *
SELECTION-SCREEN BEGIN OF BLOCK sel01.
PARAMETERS:
p_path TYPE rlgrap-filename DEFAULT '
xxxxxxxxxxxxxxxxd-f.txt',
p_langu TYPE makt-spras OBLIGATORY,
p_upd AS CHECKBOX.
SELECTION-SCREEN END OF BLOCK sel01.
CHECK sy-uname = 'XXXXXXX'.
CHECK p_upd = 'X'.
path = p_path.
CALL METHOD cl_gui_frontend_services=>gui_upload
EXPORTING
filename = path
filetype = 'ASC'
has_field_separator = 'X'
HEADER_LENGTH = 0
DAT_MODE = SPACE
CODEPAGE = SPACE
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
READ_BY_LINE = 'X'
IMPORTING
FILELENGTH =
HEADER =
CHANGING
data_tab = it_import
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
not_supported_by_gui = 17
error_no_gui = 18
OTHERS = 19
.
IF sy-subrc <> 0.
MESSAGE e038 WITH 'Error gui_upload' sy-subrc.
ENDIF.
LOOP AT it_import INTO w_import.
SELECT SINGLE concept FROM sotr_head
INTO concept
WHERE alias_name = w_import-alias_name.
IF sy-subrc <> 0.
WRITE: / 'Alias:', w_import-alias_name, 'falsch'.
CONTINUE.
ENDIF.
CLEAR: it_source, it_target.
CALL FUNCTION 'SOTR_GET_CONCEPT_FOR_EDITOR'
EXPORTING
concept = concept
source_language = 'D'
target_language = p_langu
source_context = source_context
TARGET_CONTEXT =
IMPORTING
HEADER =
TABLES
source_entries = it_source
target_entries = it_target
EXCEPTIONS
no_entry_found = 1
langu_missing = 2
inconsistent_parameter = 3
OTHERS = 4
.
IF sy-subrc <> 0.
WRITE: / 'Error: SOTR_GET_CONCEPT_FOR_EDITOR', w_import-alias_name.
CONTINUE.
ENDIF.
READ TABLE it_source INDEX 1 INTO w_source.
length = strlen( w_import-sotr_text_fsp ).
IF length > w_source-length.
WRITE: / 'Text', w_import-alias_name, 'zu lang',
w_source-length, length.
CONTINUE.
ENDIF.
READ TABLE it_target INDEX 1 INTO w_target.
IF sy-subrc <> 0.
CLEAR w_target.
w_target-concept = w_source-concept.
w_target-langu = p_langu.
w_target-lfd_num = 1.
w_target-status = 'R'.
w_target-length = w_source-length.
w_target-text = w_import-sotr_text_fsp(length).
CALL FUNCTION 'SOTR_INSERT_CONCEPT_ENTRY'
EXPORTING
concept = w_target-concept
check_master_langu = ' '
CHECK_MASTER_SYSTEM = 'X'
CHECK_CONCEPT_EXIST = 'X'
IN_UPDATE_TASK =
UPDATE_CONTEXT_FLAG = 'X'
FLAG_CORRECTION_ENTRY =
CHANGING
entry = w_target
EXCEPTIONS
concept_not_found = 1
identical_context_not_allowed = 2
text_too_long = 3
langu_missing = 4
no_master_langu = 5
error_in_update = 6
error_in_correction = 7
user_cancelled = 8
OTHERS = 9
.
IF sy-subrc <> 0.
WRITE: / 'Error: SOTR_INSERT_CONCEPT_ENTRY',
sy-subrc, w_import-alias_name.
CONTINUE.
ENDIF.
ADD 1 TO anz.
ELSE.
text_fsp = w_import-sotr_text_fsp(length).
CHECK w_target-text <> text_fsp.
w_target-text = text_fsp.
CALL FUNCTION 'SOTR_UPDATE_CONCEPT_ENTRY'
EXPORTING
entry = w_target
check_master_langu = ' '
IN_UPDATE_TASK =
FLAG_CORRECTION_ENTRY =
EXCEPTIONS
concept_not_found = 1
entry_not_found = 2
langu_missing = 3
no_master_langu = 4
error_in_correction = 5
user_cancelled = 6
OTHERS = 7
.
IF sy-subrc <> 0.
WRITE: / 'Error: SOTR_UPDATE_CONCEPT_ENTRY',
sy-subrc, w_import-alias_name.
CONTINUE.
ENDIF.
ADD 1 TO anz.
ENDIF.
ENDLOOP.
WRITE: anz, 'Texte geändert'.
I wrote two ABAP reports for OTR download/upload: with first you can download texts in a CSV format; CSV is easily readable from Microsoft Excel (and a lot of other programs), so it allows you to comfortable translate texts; with second program you can upload translation (from CSV file) into the system.
If somebody is curious about them, I can publish them.
Dany
Hi Fredric,
Consider I wrote this only for OTR creation or first traslation.
You can substitute OTR creation/update section which one already proposed some post up: it's more robust.
*&---------------------------------------------------------------------*
*& Report Z_DOWNLOAD_OTR *
*&---------------------------------------------------------------------*
*
REPORT z_download_otr.
*
TABLES:
sotr_head,
sotr_text
.
*
TYPES:
BEGIN OF ty_st_export_concept,
concept TYPE sotr_conc,
text TYPE sotr_txt,
END OF ty_st_export_concept
,
ty_t_export_concept
TYPE STANDARD TABLE OF ty_st_export_concept
WITH DEFAULT KEY
INITIAL SIZE 0
,
ty_char300(300) TYPE c
.
*
DATA:
t_otrs TYPE ty_t_export_concept,
wa_otrs LIKE LINE OF t_otrs
,
t_line
TYPE STANDARD TABLE OF ty_char300
WITH DEFAULT KEY
INITIAL SIZE 0,
wa_line LIKE LINE OF t_line
,
stringfname TYPE string
.
*
SELECT-OPTIONS:
r_paket FOR sotr_head-paket,
r_langu FOR sotr_text-langu
.
PARAMETERS:
p_fname LIKE rlgrap-filename
.
*
START-OF-SELECTION.
*
SELECT
text~concept
text~text
FROM
sotr_head AS head INNER JOIN sotr_text AS text
ON ( text~concept EQ head~concept )
INTO TABLE
t_otrs
WHERE
head~paket IN r_paket
AND text~langu IN r_langu
.
*
LOOP AT t_otrs
INTO wa_otrs
.
REPLACE ALL OCCURRENCES OF '"' IN wa_otrs-text WITH '""'.
CASE sy-subrc.
WHEN 0.
CONCATENATE
wa_otrs-concept
';"'
wa_otrs-text
'"'
INTO
wa_line
.
WHEN 2.
WRITE:/
'Error: long text: ',
wa_otrs-text,
'(',
wa_otrs-concept,
')'
.
WHEN 4.
IF wa_otrs-text CA ';'.
CONCATENATE
wa_otrs-concept
';"'
wa_otrs-text
'"'
INTO
wa_line
.
ELSE.
CONCATENATE
wa_otrs-concept
wa_otrs-text
INTO
wa_line
SEPARATED BY
';'
.
ENDIF.
WHEN 8.
WRITE:/
'Error: invalid chars: ',
wa_otrs-text,
'(',
wa_otrs-concept,
')'
.
ENDCASE.
APPEND wa_line TO t_line.
ENDLOOP.
*
stringfname = p_fname.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = stringfname
filetype = 'ASC'
confirm_overwrite = 'X'
TABLES
data_tab = t_line
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
OTHERS = 22.
IF sy-subrc NE 0.
WRITE 'Error during download'.
ENDIF.
*
MESSAGE s000(38) WITH 'Done'.
*
END-OF-SELECTION.
*
*&---------------------------------------------------------------------*
*& Report Z_UPLOAD_OTR *
*&---------------------------------------------------------------------*
REPORT z_upload_otr.
*
TYPES:
BEGIN OF ty_st_export_concept,
concept TYPE sotr_conc,
text TYPE sotr_txt,
END OF ty_st_export_concept
,
ty_t_export_concept
TYPE STANDARD TABLE OF ty_st_export_concept
WITH DEFAULT KEY
INITIAL SIZE 0
,
ty_char300(300) TYPE c
.
DATA:
t_otrs TYPE ty_t_export_concept,
wa_otrs LIKE LINE OF t_otrs
,
t_line
TYPE STANDARD TABLE OF ty_char300
WITH DEFAULT KEY
INITIAL SIZE 0,
wa_line LIKE LINE OF t_line
,
stringfname TYPE string,
rowlength TYPE i,
entry TYPE sotr_text
.
*
PARAMETERS:
p_fname LIKE rlgrap-filename,
p_langu LIKE sotr_text-langu,
p_srclan LIKE sotr_text-langu
.
*
START-OF-SELECTION.
*
stringfname = p_fname.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = stringfname
TABLES
data_tab = t_line
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 NE 0.
WRITE /'Error during file upload'.
ENDIF.
*
LOOP AT t_line
INTO wa_line
.
MOVE wa_line(32) TO wa_otrs-concept.
MOVE wa_line+33 TO wa_otrs-text.
REPLACE ALL OCCURRENCES OF '""' IN wa_otrs-text WITH '"'.
IF wa_otrs-text(1) EQ '"'.
rowlength = STRLEN( wa_otrs-text ).
SUBTRACT 2 FROM rowlength.
wa_otrs-text = wa_otrs-text+1(rowlength).
ENDIF.
*
rowlength = STRLEN( wa_otrs-text ).
*
entry-concept = wa_otrs-concept.
entry-langu = p_langu.
entry-crea_name = sy-uname.
entry-crea_tstut(8) = sy-datum.
entry-crea_tstut+8 = sy-uzeit.
entry-chan_name = sy-uname.
entry-chan_tstut(8) = sy-datum.
entry-chan_tstut+8 = sy-uzeit.
entry-source_lan = p_srclan.
entry-length = rowlength.
entry-text = wa_otrs-text.
*
CALL FUNCTION 'SOTR_INSERT_CONCEPT_ENTRY'
EXPORTING
concept = wa_otrs-concept
check_master_langu = space
CHANGING
entry = entry
EXCEPTIONS
concept_not_found = 1
identical_context_not_allowed = 2
text_too_long = 3
langu_missing = 4
no_master_langu = 5
error_in_update = 6
error_in_correction = 7
user_cancelled = 8
OTHERS = 9.
IF sy-subrc NE 0.
WRITE: /
'Error in concept: ',
wa_otrs-concept,
'. Text: ',
wa_otrs-text
.
ENDIF.
*
ENDLOOP.
*
END-OF-SELECTION.
Dany
I have asked the OTR colleagues about this topic. They are still looking at the exact situation, and have promised me an answer for later in this week.
brian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.