Skip to Content

Hello,

here I want to share some knowledge/hints how an online language switch can be implemented.

  1. SET LOCALE LANGUAGE <SPRAS> changes the current language of the current internal session. see elp.sap.com/abapdocu_702/en/abapset_locale.htm.
  2. Transactions called by Function  TH_REMOTE_TRANSACTION seem to belong to that internal session, so they use that language
    1. Parameter DEST is not an RFC destination, but ‘NONE’ is accepted. If you want to execute the function on certain servers, you can use e.g. function  TH_SERVER_LIST  to get a list of servers (also by RFC).
    2. using transaction  ‘ ‘ starts just a session
    3. ‘SESSION_MANAGER’ is also a transaction.
  3. LEAVE PROGRAM  terminates a program.

So code snippet to switch language could look like this (usage on your own risk / only for evaluation):


form SWITCH using FUW_SPRAS

                                 FUW_TCODE..

   data: LW_TCODE type TSTCTCODE.

   set locale language FUW_SPRAS.

   select single TCODE from TSTC into LW_TCODE
     where TCODE = FUW_TCODE.

   if not LW_TCODE is initial.
     call function ‘AUTHORITY_CHECK_TCODE’
       exporting
         TCODE  = LW_TCODE
       exceptions
         OK     = 1
         NOT_OK = 2.
     if SYSUBRC = 2.
       return.
     endif.
   endif.

   call function ‘TH_REMOTE_TRANSACTION’
     exporting
       TCODE = LW_TCODE
       DEST  = ‘NONE’.
   leave program.

endform.                    “SWITCH


-Jürgen-

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply