cancel
Showing results for 
Search instead for 
Did you mean: 

系统异常的翻译

Former Member
0 Kudos

HI,ALL:

在开发中遇到一个问题,在用TRY CATCH,捕捉到异常,但是用get_longtext方法赋值时,它显示的是德文,因为我登录的是中文环境,如果是登录英文环境显示的就是英文。

所以我想此异常没有中文翻译,所以它默认为德文。

所以我想在中文登录时,获得异常的英文翻译,因为英文日志是被允许的,看看大家有没有什么方法。

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

你可以用异常的属性去查询sotr_text

具体代码参见:SOTR_GET_TEXTS_WITH_KEYS

select concept lfd_num length langu text from sotr_text

into corresponding fields of table l_result_tab

for all entries in l_concepts

where concept = l_concepts-concept

and flag_cntxt = 'X'

and langu = l_concepts-langu

and lfd_num = 1

and flag_com = space.

Former Member
0 Kudos

可以做一下第二语言的 supplyment,把英文的文档复制一份为以中文为语言键的版本。

Former Member
0 Kudos

如果不想写死的话也不难啊,就先去表里面查一下对应的语言有没有维护。

没有的话再去做转换的动作就好了!

Wink

Former Member
0 Kudos

在你取长文本之前,把系统的变量sy-langu更改成英文就可以了。

已测试~


  CATCH cx_sy_arithmetic_error INTO oref. 
   if sy-langu = 'ZH' or sy-langu = 'ZF'.
      l_langu = sy-langu.
      sy-langu = 'EN'.
   endif.
    text = oref->get_longtext( ). 
    sy-langu = l_langu.   

Wink

Former Member
0 Kudos

thanks,

我就是这么做的,只是这样代码得写死。