0
votes

I access my coding in batch mode with a set system user via RFC, whose logon language is set to '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. '

Before this change we used text elements, with which it worked.
Is it possible to change the language the MESSAGE statement uses while runtime?

2
i had a similar case some time ago, are you able to set the batch-users language via SU01, logon-language or adress-language? this influences your MESSAGE's language but I also did not find this satisfying.dotchuZ
My problem is that I am bound to the user on the other system. I don't think I'm able (or rather allowed) to change the language of the user itself for every single call of my module.Tassimmo
yeah, I was neither allowed to change it. eventually you have to translate the messages and transport them to the other system ..dotchuZ
You say you want to enable the calling machine react to this message? Shouldn't you then rather send an error code (e.g. message class and number) instead of translated free text?Florian
The message I'm getting is the error message shown to the user on the other system.Tassimmo

2 Answers

3
votes

A second possible workaround is to :

  • make your RFC-enabled function module (RFM 1) return the message ID + message number + 4 optional variables
  • 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).
1
votes

A workaround could be, instead of using MESSAGE, just selecting the text of the message with the language you need (English in my example):

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.