简体   繁体   English

为 MESSAGE 语句设置语言

[英]Set Language for MESSAGE statement

I access my coding in batch mode with a set system user via RFC, whose logon language is set to 'DE'.我通过 RFC 与设置的系统用户以批处理模式访问我的编码,其登录语言设置为“DE”。 In case of an error, I use a message statement, so the application on the other system can handle this error.如果出现错误,我使用消息语句,以便其他系统上的应用程序可以处理此错误。

MESSAGE i001(ztest) INTO DATA(e_error).

The message is translated in several languages.该消息被翻译成多种语言。 Depending on the language of the user on the other system, I need the message translated.根据其他系统上用户的语言,我需要翻译消息。 But regardless of changing sy-langu or using SET (LOCALE) LANGUAGE statement, the message is still returned in german, the system users original setting (As stated in keyword documentation 'If the text environment is set using the statement SET LOCALE, this is ignored by the language in which the message is displayed. '但是无论改sy-langu还是使用SET (LOCALE) LANGUAGE语句,返回的信息仍然是德语,系统用户原始设置(如关键字文档中所述'如果使用语句SET LOCALE设置文本环境,这是被显示消息的语言忽略。'

Before this change we used text elements, with which it worked.在此更改之前,我们使用了文本元素,它可以与之配合使用。
Is it possible to change the language the MESSAGE statement uses while runtime?是否可以更改 MESSAGE 语句在运行时使用的语言?

A second possible workaround is to :第二种可能的解决方法是:

  • make your RFC-enabled function module (RFM 1) return the message ID + message number + 4 optional variables使您的 RFC-enabled 功能模块 (RFM 1) 返回消息 ID + 消息编号 + 4 个可选变量
  • after calling the RFM 1, the calling program calls the RFC-enabled function module BAPI_MESSAGE_GETDETAIL to get the text in the desired language (parameter LANGUAGE or LANGUAGE_ISO).调用 RFM 1 后,调用程序调用支持 RFC 的功能模块BAPI_MESSAGE_GETDETAIL以获取所需语言(参数 LANGUAGE 或 LANGUAGE_ISO)的文本。

A workaround could be, instead of using MESSAGE , just selecting the text of the message with the language you need (English in my example):一种解决方法可能是,而不是使用MESSAGE ,只需使用您需要的语言(在我的示例中为英语)选择消息文本:

SELECT SINGLE text
       INTO @DATA(e_error)
       FROM t100
       WHERE sprsl EQ 'E'
         AND arbgb EQ 'ZTEST'
         AND msgnr EQ '001'.

Obviously, if the message has placeholder(s), you have some more work to do.显然,如果消息有占位符,您还有一些工作要做。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM