cancel
Showing results for 
Search instead for 
Did you mean: 

BTP ABAP Environment alternative to SET LANGUAGE

MattDion
Participant
0 Kudos

Hello,

In BTP's ABAP environment, I have an application job that needs to send e-mails to users in their preferred language. In the good old days, I would use a SET LANGUAGE command to be able to retrieve translated texts in the correct language. In the BTP ABAP environment, this command is not allowed. What is the alternative to the code below?

DATA(lv_original_language) = sy-langu.
SET LANGUAGE lc_language-italian.
MESSAGE i100(mymsgclass) INTO lv_msg_text.
SET LANGUAGE lv_original_language.

Thanks,

Matt

View Entire Topic
MattDion
Participant
0 Kudos

I found the answer, the BAPI function module BAPI_MESSAGE_GETDETAIL is released. You can use this to retrieve messages in a different language:

    CALL FUNCTION 'BAPI_MESSAGE_GETDETAIL'
      EXPORTING
        id = 'MYMSGCLASS'
        number = '100'
        language = 'I'
        textformat = 'ASC'
        message_v1 = 'MYMSGVAR'
      IMPORTING
        message = lv_msg_text.
manwell77t
Explorer
0 Kudos

Pay attention: this BAPI seems to have a small bug. If the language entered is not the running language sy-langu and if your v1 replacement contains an '&' charachter there's a sort of injecion in resolution leading to a bad result (for example you want to replace with 'MAUI & Sons'). This is not happening using message instruction. Anyway in cloud i didn't find an alternative.