**
背景:
在海外项目开发中,因为涉及多语言,翻译是很常见的一个需求,往往我们需要手工去翻译大量的自建表,数据元素,域,域值,结构,消息类等等一系列开发对象,这个过程很无聊也很费时,SAP又没有提供批量翻译的入口,只能在各自的开发界面,或者SE63去针对单个对象挨个翻译,所以懒惰促使我不得不开发一个批量翻译的工具,可以在统一入口来批量维护。
程序界面:
作为开发的第一个版本,主要包括以下功能,后续根据实际需求再优化或者追加一些功能吧:
- 表翻译:表标题描述翻译、表中内置类型字段翻译。
- 视图:视图标题翻译。
- 结构:结构标题描述翻译,结构中内置类型字段翻译。
- 数据元素:数据元素描述翻译、数据元素长/中/短/标题描述翻译。
- 域:域描述翻译、域值翻译。
- 程序:程序标题翻译、程序屏幕标题翻译、程序屏幕内容翻译(菜单、GUI状态的翻译被注释掉了,有需要放开对应代码即可)。
- 函数组:函数组中所有函数描述翻译、函数参数翻译。
- 事务代码:事务代码描述翻译。
- 消息类:消息类描述翻译。
执行效果:
翻译步骤:
- 使用ALV标准下载功能下载至EXCEL,也可以直接在ALV中编辑;
- 在本地EXCEL中批量翻译好之后,点击ALV界面导入按钮①,全选后点击按钮②,黄灯代表已翻译,但与SAP标准建议翻译不一致,红灯代表尚未翻译,绿灯代表与SAP标准建议翻译一致;
- 选中需要传输的数据,点击按钮③即可将数据保存至指定请求中。
代码部署注意点:
1.ECC和S4版本中部分参数有差异,目前发现以下两处需要调整:
2.代码复制后需要创建GUI TITLE以及GUI STATUS:
3.标准函数保存翻译时,以对象类型+对象名相同的为一组去更新,所以填写翻译时以及选择时不要漏填漏选。
完整源码:
-
*
&---------------------------------------------------------------------
*
-
*
&
Report ZMULTIPLE_TRANSLATION
-
*
&---------------------------------------------------------------------
*
-
*
& Author:DeveloprMrMeng
-
*
&
Usage :Used
to translate
common development objects
-
*
&
Date :
2024.07.15
-
*
&---------------------------------------------------------------------
*
-
REPORT zmultiple_translation.
-
*----------------------------------------------------------------------
*
-
* Types Defination
-
*----------------------------------------------------------------------
*
-
TYPES:
-
* Selection
screen
-
BEGIN
OF ty_
screen,
-
package
TYPE tdevc-devclass,
"Package
-
author TYPE tadir-author, "Author
-
s_langu
TYPE lxe_log-targlng,
"Source Language
-
t_langu TYPE lxe_log-targlng, "Target Language
-
table
TYPE rsrd
1-tbma_val,
"Table
-
structure TYPE rsrd1-stru_val, "Sturcture
-
data_element
TYPE rsrd
1-drma_val,
"Data element
-
domain TYPE rsrd1-doma_val, "Domain
-
view
TYPE rsrd
1-vima_val,
"View
-
program TYPE reposrc-progname, "
Program
-
function_grp
TYPE tlibg-area,
"Function Group
-
function TYPE tfdir-funcname, "Fucntion
-
transaction
TYPE tstc-tcode,
"Transaction
-
message_class TYPE t100-arbgb, "Message
class
-
message_
no
TYPE t
100-msgnr,
"Message number
-
END OF ty_screen,
-
-
BEGIN OF ty_tadir,
-
pgmid TYPE tadir-pgmid, "
Program ID
-
object
TYPE tadir-object,
"Object Type
-
obj_name TYPE tadir-obj_name, "
Object Name
-
srcsystem
TYPE tadir-srcsystem,
"Original System
-
author TYPE tadir-author, "Author
-
devclass
TYPE tadir-devclass,
"Package
-
END OF ty_tadir,
-
tt_tadir TYPE STANDARD TABLE OF ty_tadir,
-
-
BEGIN OF ty_fungrp,
-
fungrp TYPE tfdir-pname, "
Function
group
-
END
OF ty_fungrp,
-
tt_fungrp
TYPE
STANDARD
TABLE
OF ty_fungrp,
-
-
BEGIN
OF ty_tfdir,
-
funcname
TYPE tfdir-funcname,
"Function name
-
pname TYPE tfdir-pname, "Fucntion
group full name
-
include
TYPE tfdir-include,
"index
-
END OF ty_tfdir,
-
tt_tfdir TYPE SORTED TABLE OF ty_tfdir
-
WITH UNIQUE KEY pname funcname,
-
-
BEGIN OF ty_d020s,
-
prog TYPE d020s-prog, "
Program name
-
dnum
TYPE d
020s-dnum,
"Screen number
-
END OF ty_d020s,
-
tt_d020s TYPE STANDARD TABLE OF ty_d020s
-
WITH NON-UNIQUE SORTED KEY prog COMPONENTS prog,
-
-
BEGIN OF ty_read_para,
-
objtype TYPE lxeobjtype, "
Object
type
-
objname
TYPE lxeobjname,
"Object name
-
END OF ty_read_para,
-
tt_read_para TYPE STANDARD TABLE OF ty_read_para,
-
-
ty_attobt TYPE lxe_attobt, "Translation
object
type description
-
tt_attobt
TYPE SORTED
TABLE
OF ty_attobt
-
WITH UNIQUE
KEY lang obj_
type,
-
-
ty_lxe_log
TYPE lxe_log,
"Translation log
-
tt_lxe_log TYPE STANDARD TABLE OF ty_lxe_log,
-
-
ty_t100 TYPE t100, "Message
-
tt_t
100
TYPE SORTED
TABLE
OF ty_t
100
-
WITH UNIQUE
KEY sprsl arbgb msgnr,
-
-
BEGIN
OF ty_alv,
-
obj_
type
TYPE lxe_attobt-obj_
type,
"Object Type
-
ktext TYPE lxe_attobt-ktext, "
Object
Type Description
-
objname
TYPE lxeobjname,
"Object name
-
textkey TYPE lxe_pcx_s1-textkey, "Text
key
-
icon
TYPE icon_d,
"Icon
-
s_text TYPE lxe_pcx_s1-s_text, "
Source text
-
t_text
TYPE lxe_pcx_s
1-t_text,
"Target text
-
sap_text TYPE lxe_pcx_s1-t_text, "Translation
of SAP recommendations
-
texttype
TYPE lxe_pcx_s
1-texttype,
"Text type
-
devclass TYPE tadir-devclass, "Package
-
author
TYPE tadir-author,
"Author
-
unitmlt TYPE lxe_pcx_s1-unitmlt, "Maximum
Length
of Translation
Unit
-
uppcase
TYPE lxe_pcx_s
1-uppcase,
"Only Uppercase Allowed
-
cbox TYPE cbox, "CheckBox
-
style
TYPE lvc_t_styl,
-
color
TYPE lvc_t_scol,
-
END
OF ty_alv,
-
tt_alv
TYPE
STANDARD
TABLE
OF ty_alv
-
WITH NON-UNIQUE SORTED
KEY cbox COMPONENTS cbox
-
WITH NON-UNIQUE SORTED
KEY grp COMPONENTS obj_
type ktext objname.
-
-
CONSTANTS:
-
gc_custmnr
TYPE lxecustmnr
VALUE cl_lxe_constants
=
>c_trl_
area_local.
-
*
&---------------------------------------------------------------------
*
-
*
&
Global Pramaters Defination
-
*
&---------------------------------------------------------------------
*
-
DATA:
-
gs_
screen
TYPE ty_
screen,
-
gt_tfdir
TYPE tt_tfdir,
-
gt_alv
TYPE tt_alv,
-
gt_attobt
TYPE tt_attobt,
-
gt_d
020s
TYPE tt_d
020s,
-
gt_t
100
TYPE tt_t
100,
-
gv_t_spras
TYPE spras,
-
gv_s_spras
TYPE spras.
-
-
FIELD-SYMBOLS:
-
<gs_alv
>
TYPE ty_alv.
-
-
DATA:
-
gt_r_
object
TYPE RANGE
OF tadir-object,
-
gs_r_
object LIKE
LINE
OF gt_r_
object,
-
gt_r_obj_name
TYPE RANGE
OF tadir-obj_name,
-
gs_r_obj_name LIKE
LINE
OF gt_r_obj_name.
-
*
&---------------------------------------------------------------------
*
-
*
& Selection
Screen Defination
-
*
&---------------------------------------------------------------------
*
-
SELECTION-SCREEN BEGIN
OF
BLOCK
mode
WITH FRAME TITLE gv_desc
0.
-
PARAMETERS:
-
p_tabl
AS CHECKBOX
DEFAULT
'' USER-COMMAND tabl,
-
p_view
AS CHECKBOX
DEFAULT
'' USER-COMMAND view,
-
p_stru
AS CHECKBOX
DEFAULT
'' USER-COMMAND stru,
-
p_dtel
AS CHECKBOX
DEFAULT
'' USER-COMMAND dtel,
-
p_doma
AS CHECKBOX
DEFAULT
'' USER-COMMAND doma,
-
p_prog
AS CHECKBOX
DEFAULT
'' USER-COMMAND prog,
-
p_fugr
AS CHECKBOX
DEFAULT
'' USER-COMMAND fugr,
-
p_tran
AS CHECKBOX
DEFAULT
'' USER-COMMAND tran,
-
p_mess
AS CHECKBOX
DEFAULT
'' USER-COMMAND mess.
-
SELECTION-SCREEN
END
OF
BLOCK
mode.
-
-
SELECTION-SCREEN BEGIN
OF
BLOCK tra
WITH FRAME TITLE gv_desc
1.
-
PARAMETERS:
-
p_sour
TYPE ty_screen-s_langu,
-
p_targ
TYPE ty_screen-t_langu.
-
SELECTION-SCREEN
END
OF
BLOCK tra.
-
-
SELECTION-SCREEN BEGIN
OF
BLOCK opt
WITH FRAME TITLE gv_desc
2.
-
SELECT-OPTIONS:
-
s_pack
FOR gs_screen-package,
-
s_auth
FOR gs_screen-author.
-
SELECTION-SCREEN
END
OF
BLOCK opt.
-
-
SELECTION-SCREEN BEGIN
OF
BLOCK ddic
WITH FRAME TITLE gv_desc
3.
-
SELECT-OPTIONS:
-
s_tabl
FOR gs_screen-table MODIF ID tab,
-
s_view
FOR gs_screen-view MODIF ID vie,
-
s_stru
FOR gs_screen-structure MODIF ID str,
-
s_dtel
FOR gs_screen-data_element MODIF ID dte,
-
s_doma
FOR gs_screen-domain MODIF ID dom.
-
SELECTION-SCREEN
END
OF
BLOCK ddic.
-
-
SELECTION-SCREEN BEGIN
OF
BLOCK prog
WITH FRAME TITLE gv_desc
4.
-
SELECT-OPTIONS:
-
s_prog
FOR gs_screen-program MODIF ID pro.
-
SELECTION-SCREEN
END
OF
BLOCK prog.
-
-
SELECTION-SCREEN BEGIN
OF
BLOCK func
WITH FRAME TITLE gv_desc
5.
-
SELECT-OPTIONS:
-
s_fugr
FOR gs_screen-function_grp MODIF ID fug.
-
SELECTION-SCREEN
END
OF
BLOCK func.
-
-
SELECTION-SCREEN BEGIN
OF
BLOCK trsc
WITH FRAME TITLE gv_desc
6.
-
SELECT-OPTIONS:
-
s_tran
FOR gs_screen-transaction MODIF ID tra.
-
SELECTION-SCREEN
END
OF
BLOCK trsc.
-
-
SELECTION-SCREEN BEGIN
OF
BLOCK mess
WITH FRAME TITLE gv_desc
7.
-
SELECT-OPTIONS:
-
s_mscl
FOR gs_screen-message_
class MODIF ID mes,
-
s_msno
FOR gs_screen-message_
no MODIF ID mes.
-
SELECTION-SCREEN
END
OF
BLOCK mess.
-
-
PARAMETERS:
-
p_only
AS CHECKBOX
DEFAULT
'X'.
-
*
&---------------------------------------------------------------------
*
-
*
& INITIALIZATION
-
*
&---------------------------------------------------------------------
*
-
INITIALIZATION.
-
*
Initial some paramaters
-
PERFORM frm_
initial.
-
*
&---------------------------------------------------------------------
*
-
*
& SELECTION-SCREEN
OUTPUT
-
*
&---------------------------------------------------------------------
*
-
AT SELECTION-SCREEN
OUTPUT.
-
* Update
screen defore
screen
output
-
PERFORM frm_update_
screen.
-
*
&---------------------------------------------------------------------
*
-
*
& SELECTION-SCREEN
Search Help
-
*
&---------------------------------------------------------------------
*
-
AT SELECTION-SCREEN
ON VALUE-REQUEST
FOR p_sour.
-
PERFORM frm_f
4_
for_language
USING
'P_SOUR' CHANGING p_sour.
-
-
AT SELECTION-SCREEN
ON VALUE-REQUEST
FOR p_targ.
-
PERFORM frm_f
4_
for_language
USING
'P_TARG' CHANGING p_targ.
-
*
&---------------------------------------------------------------------
*
-
*
& START-OF-SELECTION
-
*
&---------------------------------------------------------------------
*
-
START-OF-SELECTION.
-
* Process
Start
-
PERFORM frm_
start_process.
-
*
&---------------------------------------------------------------------
*
-
*
& Form FRM_
INITIAL
-
*
&---------------------------------------------------------------------
*
-
*
&
Initial some paramaters
-
*
&---------------------------------------------------------------------
*
-
FORM frm_
initial .
-
gv_desc
0
=
'Translation Scope'(
000).
-
gv_desc
1
=
'Translation Mode'(
001).
-
gv_desc
2
=
'Default Condition'(
002).
-
gv_desc
3
=
'DDIC Condition'(
003).
-
gv_desc
4
=
'Program Condition'(
004).
-
gv_desc
5
=
'Function Condition'(
005).
-
gv_desc
6
=
'Transaction Condition'(
006).
-
gv_desc
7
=
'Message Condition'(
007).
-
-
%_p_tabl_%_app_%-text
=
'Table'(
008).
-
%_p_stru_%_app_%-text
=
'Structure'(
009).
-
%_p_dtel_%_app_%-text
=
'Data Element'(
010).
-
%_p_doma_%_app_%-text
=
'Domain'(
011).
-
%_p_view_%_app_%-text
=
'View'(
012).
-
%_p_prog_%_app_%-text
=
'Program'(
013).
-
%_p_fugr_%_app_%-text
=
'Function Group'(
014).
-
%_p_tran_%_app_%-text
=
'Transaction'(
015).
-
%_p_mess_%_app_%-text
=
'Message'(
016).
-
-
%_p_sour_%_app_%-text
=
'Source Language'(
017).
-
%_p_targ_%_app_%-text
=
'Target Language'(
018).
-
%_s_pack_%_app_%-text
=
'Package'(
019).
-
%_s_auth_%_app_%-text
=
'Author'(
020).
-
%_s_tabl_%_app_%-text
=
'Table Name'(
021).
-
%_s_view_%_app_%-text
=
'View Name'(
022).
-
%_s_stru_%_app_%-text
=
'Structure Name'(
023).
-
%_s_dtel_%_app_%-text
=
'Data Element Name'(
024).
-
%_s_doma_%_app_%-text
=
'Domain Name'(
025).
-
%_s_prog_%_app_%-text
=
'Program Name'(
026).
-
%_s_fugr_%_app_%-text
=
'Function Group Name'(
027).
-
%_s_tran_%_app_%-text
=
'Transaction Code'(
028).
-
%_s_mscl_%_app_%-text
=
'Message Class'(
029).
-
%_s_msno_%_app_%-text
=
'Message Number'(
030).
-
%_p_only_%_app_%-text
=
'Untranslated only'(
031).
-
ENDFORM.
-
*
&---------------------------------------------------------------------
*
-
*
& Form FRM_UPDATE_
SCREEN
-
*
&---------------------------------------------------------------------
*
-
*
& Update
screen defore
screen
output
-
*
&---------------------------------------------------------------------
*
-
FORM frm_update_
screen .
-
LOOP
AT
SCREEN.
-
IF screen-name
=
'S_PACK-LOW'
OR screen-name
=
'P_SOUR'
OR screen-name
=
'P_TARG'.
-
screen-required
=
'2'.
-
ENDIF.
-
-
IF p_tabl
=
''.
-
IF screen-group
1
=
'TAB'.
-
screen-active
=
0.
-
ENDIF.
-
ENDIF.
-
-
IF p_stru
=
''.
-
IF screen-group
1
=
'STR'.
-
screen-active
=
0.
-
ENDIF.
-
ENDIF.
-
-
IF p_dtel
=
''.
-
IF screen-group
1
=
'DTE'.
-
screen-active
=
0.
-
ENDIF.
-
ENDIF.
-
-
IF p_doma
=
''.
-
IF screen-group
1
=
'DOM'.
-
screen-active
=
0.
-
ENDIF.
-
ENDIF.
-
-
IF p_view
=
''.
-
IF screen-group
1
=
'VIE'.
-
screen-active
=
0.
-
ENDIF.
-
ENDIF.
-
-
IF p_prog
=
''.
-
IF screen-group
1
=
'PRO'.
-
screen-active
=
0.
-
ENDIF.
-
ENDIF.
-
-
IF p_fugr
=
''.
-
IF screen-group
1
=
'FUG'.
-
screen-active
=
0.
-
ENDIF.
-
ENDIF.
-
-
IF p_tran
=
''.
-
IF screen-group
1
=
'TRA'.
-
screen-active
=
0.
-
ENDIF.
-
ENDIF.
-
-
IF p_mess
=
''.
-
IF screen-group
1
=
'MES'.
-
screen-active
=
0.
-
ENDIF.
-
ENDIF.
-
-
MODIFY
SCREEN.
-
ENDLOOP.
-
ENDFORM.
-
*
&---------------------------------------------------------------------
*
-
*
& Form FRM_
START_PROCESS
-
*
&---------------------------------------------------------------------
*
-
*
& Process
Start
-
*
&---------------------------------------------------------------------
*
-
FORM frm_
start_process .
-
* Check
input
-
PERFORM frm_check_
input.
-
-
*
Get translation objects
-
PERFORM frm_
get_
object.
-
-
* Show result
as ALV
-
PERFORM frm_
display_alv.
-
ENDFORM.
-
*
&---------------------------------------------------------------------
*
-
*
& Form FRM_CHECK_
INPUT
-
*
&---------------------------------------------------------------------
*
-
*
& Check
input
-
*
&---------------------------------------------------------------------
*
-
FORM frm_check_
input .
-
IF p_tabl
IS
INITIAL
AND
-
p_view
IS
INITIAL
AND
-
p_stru
IS
INITIAL
AND
-
p_dtel
IS
INITIAL
AND
-
p_doma
IS
INITIAL
AND
-
p_prog
IS
INITIAL
AND
-
p_fugr
IS
INITIAL
AND
-
p_tran
IS
INITIAL
AND
-
p_mess
IS
INITIAL.
-
-
MESSAGE
'Please select at least one transaction scope!'(m
01)
TYPE
'S'
DISPLAY LIKE
'E'.
-
LEAVE LIST-PROCESSING.
-
ENDIF.
-
-
IF s_pack
IS
INITIAL.
-
* Fill out
all required entry fields
-
MESSAGE s
055(
00)
DISPLAY LIKE
'E'.
-
LEAVE LIST-PROCESSING.
-
ENDIF.
-
-
LOOP
AT s_pack.
-
IF ( s_pack-low
+
0(
1)
<>
'Z'
AND s_pack-low
+
0(
1)
<>
'Y'
AND s_pack-low
IS
NOT
INITIAL
AND s_pack-low
<>
'$TMP' )
OR
-
( s_pack-high
+
0(
1)
<>
'Z'
AND s_pack-high
+
0(
1)
<>
'Y'
AND s_pack-high
IS
NOT
INITIAL
AND s_pack-high
<>
'$TMP' ).
-
-
MESSAGE
'You can select only objects in the custom namespace'(m
02)
TYPE
'S'
DISPLAY LIKE
'E'.
-
LEAVE LIST-PROCESSING.
-
ENDIF.
-
ENDLOOP.
-
ENDFORM.
-
*
&---------------------------------------------------------------------
*
-
*
& Form FRM_
GET_
OBJECT
-
*
&---------------------------------------------------------------------
*
-
*
&
Get translation objects
-
*
&---------------------------------------------------------------------
*
-
FORM frm_
get_
object .
-
* Build
select condtion scope
-
PERFORM frm_build_scope_cond.
-
-
*
Get tranlation list
-
PERFORM frm_
get_list.
-
ENDFORM.
-
*
&---------------------------------------------------------------------
*
-
*
& Form FRM_
DISPLAY_ALV
-
*
&---------------------------------------------------------------------
*
-
*
& Show result
as ALV
-
*
&---------------------------------------------------------------------
*
-
FORM frm_
display_alv .
-
DATA:
-
ls_layout
TYPE lvc_s_layo,
-
lt_fieldcat
TYPE lvc_t_fcat,
-
ls_fieldcat
TYPE lvc_s_fcat,
-
lt_event_
exit
TYPE slis_t_event_
exit,
-
ls_event_
exit
TYPE slis_event_
exit.
-
-
*
Set Layout
-
ls_layout-zebra
=
'X'.
"Alternating line color
-
ls_layout-sel_mode = 'C'. "SelectionMode
-
ls_layout-cwidth_opt
=
'X'.
"Optimize column width
-
ls_layout-box_fname = 'CBOX'. "Field name
of internal
table field
-
ls_layout-stylefname
=
'STYLE'.
"Field name of internal table field
-
ls_layout-ctab_fname = 'COLOR'. "Field name
with complex cell color coding
-
-
*
Set fieldcat
-
ls_fieldcat-fieldname
=
'OBJ_TYPE'.
-
ls_fieldcat-scrtext_l
=
'Translation Object Type'(f
02).
-
APPEND ls_fieldcat
TO lt_fieldcat.
-
CLEAR ls_fieldcat.
-
-
ls_fieldcat-fieldname
=
'KTEXT'.
-
ls_fieldcat-scrtext_l
=
'Object Type Description'(f
03).
-
APPEND ls_fieldcat
TO lt_fieldcat.
-
CLEAR ls_fieldcat.
-
-
ls_fieldcat-fieldname
=
'OBJNAME'.
-
ls_fieldcat-scrtext_l
=
'Object Name'(f
04).
-
APPEND ls_fieldcat
TO lt_fieldcat.
-
CLEAR ls_fieldcat.
-
-
ls_fieldcat-fieldname
=
'TEXTKEY'.
-
ls_fieldcat-scrtext_l
=
'Text Key'(f
05).
-
APPEND ls_fieldcat
TO lt_fieldcat.
-
CLEAR ls_fieldcat.
-
-
ls_fieldcat-fieldname
=
'ICON'.
-
ls_fieldcat-just
=
'C'.
-
ls_fieldcat-scrtext_l
=
'Status'(f
08).
-
APPEND ls_fieldcat
TO lt_fieldcat.
-
CLEAR ls_fieldcat.
-
-
ls_fieldcat-fieldname
=
'S_TEXT'.
-
ls_fieldcat-scrtext_l
=
'Source Text'(f
06).
-
APPEND ls_fieldcat
TO lt_fieldcat.
-
CLEAR ls_fieldcat.
-
-
ls_fieldcat-fieldname
=
'T_TEXT'.
-
ls_fieldcat-edit
=
'X'.
-
ls_fieldcat-lowercase
=
'X'.
-
ls_fieldcat-outputlen
=
255.
-
ls_fieldcat-intlen
=
255.
-
ls_fieldcat-dd_outlen
=
255.
-
ls_fieldcat-scrtext_l
=
'Target Text'(f
07).
-
APPEND ls_fieldcat
TO lt_fieldcat.
-
CLEAR ls_fieldcat.
-
-
ls_fieldcat-fieldname
=
'SAP_TEXT'.
-
ls_fieldcat-scrtext_l
=
'SAP recommendations'(f
09).
-
APPEND ls_fieldcat
TO lt_fieldcat.
-
CLEAR ls_fieldcat.
-
-
ls_fieldcat-fieldname
=
'TEXTTYPE'.
-
ls_fieldcat-scrtext_l
=
'Text Type'(f
10).
-
APPEND ls_fieldcat
TO lt_fieldcat.
-
CLEAR ls_fieldcat.
-
-
ls_fieldcat-fieldname
=
'DEVCLASS'.
-
ls_fieldcat-scrtext_l
=
'Package'(f
11).
-
APPEND ls_fieldcat
TO lt_fieldcat.
-
CLEAR ls_fieldcat.
-
-
ls_fieldcat-fieldname
=
'AUTHOR'.
-
ls_fieldcat-scrtext_l
=
'Author'(f
12).
-
APPEND ls_fieldcat
TO lt_fieldcat.
-
CLEAR ls_fieldcat.
-
-
* Show ALV
-
CALL
FUNCTION
'REUSE_ALV_GRID_DISPLAY_LVC'
-
EXPORTING
-
i_callback_
program
= sy-repid
-
i_callback_
pf_
status_
set
=
'FRM_STATUS_SET'
-
i_callback_user_command
=
'FRM_USER_COMMAND'
-
is_layout_lvc
= ls_layout
-
it_fieldcat_lvc
= lt_fieldcat
-
it_event_
exit
= lt_event_
exit
-
i_save
=
'A'
-
TABLES
-
t_outtab
= gt_alv
-
EXCEPTIONS
-
program_
error
=
1
-
OTHERS
=
2.
-
ENDFORM.
-
*
&---------------------------------------------------------------------
*
-
*
& Form FRM_BUILD_SCOPE_COND
-
*
&---------------------------------------------------------------------
*
-
*
& Build
select condtion scope
-
*
&---------------------------------------------------------------------
*
-
FORM frm_build_scope_cond .
-
gs_r_object-sign
=
'I'.
-
gs_r_object-option
=
'EQ'.
-
-
IF p_tabl
= abap_
on
OR p_stru
= abap_
on.
-
gs_r_object-low
=
'TABL'.
-
APPEND gs_r_
object
TO gt_r_
object.
-
ENDIF.
-
-
IF p_view
= abap_
on.
-
gs_r_object-low
=
'VIEW'.
-
APPEND gs_r_
object
TO gt_r_
object.
-
ENDIF.
-
-
IF p_dtel
= abap_
on.
-
gs_r_object-low
=
'DTEL'.
-
APPEND gs_r_
object
TO gt_r_
object.
-
ENDIF.
-
-
IF p_doma
= abap_
on.
-
gs_r_object-low
=
'DOMA'.
-
APPEND gs_r_
object
TO gt_r_
object.
-
ENDIF.
-
-
IF p_prog
= abap_
on.
-
gs_r_object-low
=
'PROG'.
-
APPEND gs_r_
object
TO gt_r_
object.
-
ENDIF.
-
-
IF p_fugr
= abap_
on.
-
gs_r_object-low
=
'FUGR'.
-
APPEND gs_r_
object
TO gt_r_
object.
-
ENDIF.
-
-
IF p_tran
= abap_
on.
-
gs_r_object-low
=
'TRAN'.
-
APPEND gs_r_
object
TO gt_r_
object.
-
ENDIF.
-
-
IF p_mess
= abap_
on.
-
gs_r_object-low
=
'MSAG'.
-
APPEND gs_r_
object
TO gt_r_
object.
-
ENDIF.
-
-
APPEND
LINES
OF s_tabl
TO gt_r_obj_name.
-
APPEND
LINES
OF s_view
TO gt_r_obj_name.
-
APPEND
LINES
OF s_stru
TO gt_r_obj_name.
-
APPEND
LINES
OF s_dtel
TO gt_r_obj_name.
-
APPEND
LINES
OF s_doma
TO gt_r_obj_name.
-
APPEND
LINES
OF s_prog
TO gt_r_obj_name.
-
APPEND
LINES
OF s_fugr
TO gt_r_obj_name.
-
APPEND
LINES
OF s_tran
TO gt_r_obj_name.
-
APPEND
LINES
OF s_mscl
TO gt_r_obj_name.
-
ENDFORM.
-
*
&---------------------------------------------------------------------
*
-
*
& Form FRM_
GET_LIST
-
*
&---------------------------------------------------------------------
*
-
*
&
Get tranlation list
-
*
&---------------------------------------------------------------------
*
-
FORM frm_
get_list .
-
DATA:
-
lt_tadir
TYPE tt_tadir,
-
lt_tadir_
copy
TYPE tt_tadir,
-
ls_tadir
TYPE ty_tadir,
-
lt_fungrp
TYPE tt_fungrp,
-
ls_fungrp
TYPE ty_fungrp,
-
lt_attobt
TYPE tt_attobt,
-
ls_attobt
TYPE ty_attobt,
-
ls_t
100
TYPE ty_t
100.
-
-
*
Get SPRAS
-
SELECT SINGLE r
3_lang
INTO gv_s_spras
FROM lxe_t
002x WHERE language
= p_sour.
-
SELECT SINGLE r
3_lang
INTO gv_t_spras
FROM lxe_t
002x WHERE language
= p_targ.
-
-
*
Get check list
for transaction
-
SELECT pgmid
-
object
-
obj_name
-
srcsystem
-
author
-
devclass
-
INTO
TABLE lt_tadir
-
FROM tadir
-
WHERE pgmid
=
'R3TR'
-
AND
object
IN gt_r_
object
-
AND obj_name
IN gt_r_obj_name
-
AND devclass
IN s_pack
-
AND author
IN s_auth
-
AND delflag
=
''.
-
-
*
If checked
Function
Group,
get
function list
also.
-
IF p_fugr
= abap_
on.
-
LOOP
AT lt_tadir
INTO ls_tadir WHERE
object
=
'FUGR'.
-
ls_fungrp-fungrp
=
'SAPL'
&
& ls_tadir-obj_name.
-
COLLECT ls_fungrp
INTO lt_fungrp.
-
CLEAR ls_fungrp.
-
ENDLOOP.
-
-
IF lt_fungrp
IS
NOT
INITIAL.
-
-
*
Get
function list
-
SELECT funcname
-
pname
-
include
-
INTO
TABLE gt_tfdir
-
FROM tfdir
-
FOR
ALL ENTRIES
IN lt_fungrp
-
WHERE pname
= lt_fungrp-fungrp.
-
ENDIF.
-
ENDIF.
-
-
IF p_prog
= abap_
on.
-
lt_tadir_
copy
= lt_tadir.
-
DELETE lt_tadir_
copy WHERE
object
<>
'PROG'.
-
IF lt_tadir_
copy
IS
NOT
INITIAL.
-
-
*
Get
program
screen list
-
SELECT prog
-
dnum
-
INTO
TABLE gt_d
020s
-
FROM d
020s
-
FOR
ALL ENTRIES
IN lt_tadir_
copy
-
WHERE prog
= lt_tadir_copy-obj_name.
-
ENDIF.
-
ENDIF.
-
-
IF p_mess
= abap_
on.
-
*
Get message info
-
SELECT
*
-
INTO
TABLE gt_t
100
-
FROM t
100
-
WHERE sprsl
= gv_s_spras
-
AND arbgb
IN s_mscl
-
AND msgnr
IN s_msno.
-
ENDIF.
-
-
*
Get Texts
for
Object Attribute
-
SELECT
*
-
INTO
TABLE gt_attobt
-
FROM lxe_attobt
-
WHERE lang
= sy-langu.
-
-
SORT lt_tadir
BY
object
ASCENDING
-
obj_name
ASCENDING.
-
-
CALL
FUNCTION
'SAPGUI_PROGRESS_INDICATOR'
-
EXPORTING
-
text
=
'Data Processing...'(m
07).
-
-
LOOP
AT lt_tadir
INTO ls_tadir.
-
*
Get current translation info
-
PERFORM frm_obj_text_
read
USING ls_tadir.
-
ENDLOOP.
-
-
IF gt_alv
IS
INITIAL.
-
MESSAGE
'No data!'(m
03)
TYPE
'S'.
-
LEAVE LIST-PROCESSING.
-
ENDIF.
-
ENDFORM.
-
*
&---------------------------------------------------------------------
*
-
*
& Form FRM_F
4_
FOR_LANGUAGE
-
*
&---------------------------------------------------------------------
*
-
*
& F
4
For Language
-
*
&---------------------------------------------------------------------
*
-
*
&
<-- CV_LANGUAGE Language
-
*
&---------------------------------------------------------------------
*
-
FORM frm_f
4_
for_language
USING uv_fname CHANGING cv_language.
-
CALL
FUNCTION
'LXE_T002_SELECT_LANGUAGE'
-
EXPORTING
-
dynpprog
= sy-cprog
-
dynpnr
= sy-dynnr
-
dynpfield
= uv_fname
-
IMPORTING
-
language
= cv_language
-
EXCEPTIONS
-
parameter_
error
=
1
-
no_
values_found
=
2
-
no_selection
=
3
-
OTHERS
=
4.
-
ENDFORM.
-
*
&---------------------------------------------------------------------
*
-
*
& Form FRM_OBJ_TEXT_
READ
-
*
&---------------------------------------------------------------------
*
-
*
&
Get current translation info
-
*
&---------------------------------------------------------------------
*
-
*
& --
> US_TADIR
-
*
&---------------------------------------------------------------------
*
-
FORM frm_obj_text_
read
USING us_tadir
TYPE ty_tadir.
-
DATA:
-
lt_
read_para
TYPE tt_
read_para,
-
ls_
read_para
TYPE ty_
read_para,
-
ls_alv
TYPE ty_alv,
-
ls_color
TYPE lvc_s_scol,
-
ls_tfdir
TYPE ty_tfdir,
-
ls_attobt
TYPE ty_attobt,
-
lv_fungrp
TYPE tfdir-pname,
-
ls_d
020s
TYPE ty_d
020s,
-
ls_t
100
TYPE ty_t
100.
-
-
DATA:
-
lt_pcx_s
1
TYPE
STANDARD
TABLE
OF lxe_pcx_s
1,
-
ls_pcx_s
1
TYPE lxe_pcx_s
1,
-
lt_pcx_s
2
TYPE
STANDARD
TABLE
OF lxe_pcx_s
2,
-
ls_pcx_s
2
TYPE lxe_pcx_s
2,
-
lv_domatyp
TYPE lxedomatyp,
-
lv_domanam
TYPE lxedomanam,
-
lv_pstatus
TYPE lxestatprc.
-
-
CASE us_tadir-object.
-
*
Table
or Sturcture
-
WHEN
'TABL'.
-
ls_
read_para-objtype
=
'BEZD'.
"Foreign Key
-
ls_read_para-objname = us_tadir-obj_name.
-
APPEND ls_read_para TO lt_read_para.
-
ls_read_para-objtype = 'TABT'. "
Table
and Built-in
type description
-
ls_
read_para-objname
= us_tadir-obj_name.
-
APPEND ls_
read_para
TO lt_
read_para.
-
* View
-
WHEN
'VIEW'.
-
ls_
read_para-objtype
=
'VIEW'.
-
ls_
read_para-objname
= us_tadir-obj_name.
"View description
-
APPEND ls_read_para TO lt_read_para.
-
* Data Element
-
WHEN 'DTEL'.
-
ls_read_para-objtype = 'DTEL'. "
Data element
and description
-
ls_
read_para-objname
= us_tadir-obj_name.
-
APPEND ls_
read_para
TO lt_
read_para.
-
* Domain
-
WHEN
'DOMA'.
-
ls_
read_para-objtype
=
'DOMA'.
"Domain description
-
ls_read_para-objname = us_tadir-obj_name.
-
APPEND ls_read_para TO lt_read_para.
-
-
ls_read_para-objtype = 'VALU'. "Domain
value
-
ls_
read_para-objname
= us_tadir-obj_name.
-
APPEND ls_
read_para
TO lt_
read_para.
-
*
Program
-
WHEN
'PROG'.
-
ls_
read_para-objtype
=
'RPT4'.
"Title
-
ls_read_para-objname = us_tadir-obj_name.
-
APPEND ls_read_para TO lt_read_para.
-
* ls_read_para-objtype = 'CA4'. "Menu
-
* ls_
read_para-objname
= us_tadir-obj_name.
-
* APPEND ls_
read_para
TO lt_
read_para.
-
* ls_
read_para-objtype
=
'CAD4'.
"GUI Status
-
* ls_read_para-objname = us_tadir-obj_name.
-
* APPEND ls_read_para TO lt_read_para.
-
-
LOOP AT gt_d020s INTO ls_d020s USING KEY prog WHERE prog = us_tadir-obj_name.
-
ls_read_para-objtype = 'SRH4'. "
Screen title
-
-
CONCATENATE us_tadir-obj_name
-
ls_d
020s-dnum
-
INTO ls_
read_para-objname RESPECTING BLANKS.
"Program name + Screen number
-
APPEND ls_read_para TO lt_read_para.
-
ls_read_para-objtype = 'SRT4'. "
Screen texts
-
-
CONCATENATE us_tadir-obj_name
-
ls_d
020s-dnum
-
INTO ls_
read_para-objname RESPECTING BLANKS.
"Program name + Screen number
-
APPEND ls_read_para TO lt_read_para.
-
ENDLOOP.
-
* Function Group
-
WHEN 'FUGR'.
-
ls_read_para-objtype = 'RPT1'. "
Function
group
-
ls_
read_para-objname
= us_tadir-obj_name.
-
APPEND ls_
read_para
TO lt_
read_para.
-
-
lv_fungrp
=
'SAPL'
&
& us_tadir-obj_name.
-
-
LOOP
AT gt_tfdir
INTO ls_tfdir WHERE pname
= lv_fungrp.
-
ls_
read_para-objtype
=
'FNC1'.
"Function and parameters
-
-
CONCATENATE ls_tfdir-funcname
-
us_tadir-obj_name
-
INTO ls_read_para-objname RESPECTING BLANKS. "
Function
group
+
Function name
-
APPEND ls_
read_para
TO lt_
read_para.
-
ENDLOOP.
-
* Transaction
Code
-
WHEN
'TRAN'.
-
ls_
read_para-objtype
=
'TRAN'.
"Transaction code
-
ls_read_para-objname = us_tadir-obj_name.
-
APPEND ls_read_para TO lt_read_para.
-
WHEN 'MSAG'.
-
LOOP AT gt_t100 INTO ls_t100 WHERE arbgb = us_tadir-obj_name.
-
ls_read_para-objtype = 'MESS'. "Message
-
-
CONCATENATE ls_t
100-arbgb
-
ls_t
100-msgnr
-
INTO ls_
read_para-objname RESPECTING BLANKS.
"Message class + Message number
-
APPEND ls_read_para TO lt_read_para.
-
ENDLOOP.
-
WHEN OTHERS.
-
ENDCASE.
-
-
LOOP AT lt_read_para INTO ls_read_para.
-
* Get translation info
-
CALL FUNCTION 'LXE_OBJ_TEXT_PAIR_READ'
-
EXPORTING
-
t_lang = p_targ
-
s_lang = p_sour
-
custmnr = gc_custmnr
-
objtype = ls_read_para-objtype
-
objname = ls_read_para-objname
-
read_only = ''
-
IMPORTING
-
domatyp = lv_domatyp
-
domanam = lv_domanam
-
pstatus = lv_pstatus
-
TABLES
-
lt_pcx_s1 = lt_pcx_s1.
-
-
* Get best translation
-
CALL FUNCTION 'LXE_PP1_PROPOSALS_GET'
-
EXPORTING
-
s_lang = p_sour
-
t_lang = p_targ
-
custmnr = gc_custmnr
-
objtype = ls_read_para-objtype
-
domatyp = lv_domatyp
-
domanam = lv_domanam
-
IMPORTING
-
pstatus = lv_pstatus
-
TABLES
-
t_pcx_s1 = lt_pcx_s1
-
t_pcx_s2 = lt_pcx_s2.
-
-
IF lt_pcx_s1 IS NOT INITIAL.
-
READ TABLE gt_attobt INTO ls_attobt
-
WITH KEY lang = sy-langu
-
obj_type = ls_read_para-objtype.
-
-
LOOP AT lt_pcx_s1 INTO ls_pcx_s1.
-
ls_alv-obj_type = ls_read_para-objtype. "Translation OType
-
ls_alv-ktext
= ls_attobt-ktext.
"Translation OType description
-
ls_alv-objname = ls_read_para-objname. "
Object name
-
ls_alv-textkey
= ls_pcx_s
1-textkey.
"Text key
-
ls_alv-s_text = ls_pcx_s1-s_text. "
Source text
-
ls_alv-t_text
= ls_pcx_s
1-t_text.
"Target text
-
ls_alv-unitmlt = ls_pcx_s1-unitmlt. "Maximum
Length
of Translation
Unit
-
ls_alv-uppcase
= ls_pcx_s
1-uppcase.
"Only Uppercase Allowed
-
ls_alv-devclass = us_tadir-devclass. "Package
-
ls_alv-author
= us_tadir-author.
"Author
-
-
READ TABLE lt_pcx_s2 INTO ls_pcx_s2
-
WITH KEY textkey = ls_pcx_s1-textkey.
-
IF sy-subrc = 0.
-
ls_alv-sap_text = ls_pcx_s2-best_prop. "Translation
of SAP recommendations
-
ENDIF.
-
-
ls_alv-texttype
= ls_pcx_s
1-texttype.
"Text type
-
-
IF ls_alv-t_text IS NOT INITIAL.
-
IF ls_alv-t_text = ls_alv-sap_text.
-
ls_alv-icon = icon_led_green. "Green
-
ELSE.
-
ls_alv-icon
= icon_led_yellow.
"Yellow
-
ENDIF.
-
ELSE.
-
ls_alv-icon = icon_led_red. "Red
-
ENDIF.
-
-
IF p_only
= abap_
on
AND ls_alv-t_text
IS
NOT
INITIAL.
-
CLEAR:ls_alv.
-
CONTINUE.
-
ENDIF.
-
-
APPEND ls_alv
TO gt_alv.
-
-
CLEAR:ls_alv.
-
ENDLOOP.
-
ENDIF.
-
-
CLEAR:
-
lt_pcx_s
1,
-
ls_pcx_s
1,
-
lt_pcx_s
2,
-
ls_pcx_s
2.
-
ENDLOOP.
-
ENDFORM.
-
*
&---------------------------------------------------------------------
*
-
*
& Form FRM_
STATUS_
SET
-
*
&---------------------------------------------------------------------
*
-
*
&
Set GUI
Status
-
*
&---------------------------------------------------------------------
*
-
*
& --
> RT_EXTAB Excluding Button
-
*
&---------------------------------------------------------------------
*
-
FORM frm_
status_
set
USING rt_extab
TYPE slis_t_extab.
-
DATA:
-
lv_title
TYPE
string.
-
-
SELECT SINGLE text
-
INTO lv_title
-
FROM trdirt
-
WHERE name
= sy-repid
-
AND sprsl
= sy-langu.
-
-
lv_title
= lv_title
&
& ` (`
&
& p_sour
&
& `-
>`
&
& p_targ
&
& `)`.
-
-
SET PF-STATUS
'STATUS'.
-
SET TITLEBAR
'TITLE'
WITH lv_title.
-
ENDFORM.
"FRM_STATUS_SET
-
*&---------------------------------------------------------------------*
-
*& Form FRM_USER_COMMAND
-
*&---------------------------------------------------------------------*
-
*& User Command
-
*&---------------------------------------------------------------------*
-
*& --> R_UCOMM User Command Code
-
*& --> RS_SELFIELD Filed Info
-
*&---------------------------------------------------------------------*
-
FORM frm_user_command USING r_ucomm LIKE sy-ucomm
-
rs_selfield TYPE slis_selfield.
-
DATA:
-
lo_grid TYPE REF TO cl_gui_alv_grid,
-
ls_stable TYPE lvc_s_stbl,
-
lv_valid TYPE char1,
-
ls_layout TYPE lvc_s_layo,
-
lv_refresh TYPE char1.
-
-
ls_stable-row = 'X'.
-
ls_stable-col = 'X'.
-