cancel
Showing results for 
Search instead for 
Did you mean: 

Issue with Set Locale Language

vishal006
Explorer
0 Kudos

I have requirement where in i need to change sy-langu depending upon user selection.
My selection screen has different language options, once the user select any option for e.g 'English'
Then the next screen will be shown in English language. For this i have used SET LOCALE LANGUAGE followed by user selection like 'E' for English, 'D' for German and so on.
The issue is like when the user selects the language 1st time say German then the next screen changes to selected language as expected, but now if i come back to main screen and now i select some other language say English so now the next screen should change to English but in my case it Stays in German.
That is whatever language i select at first it stays in that language.

AT SELECTION-SCREEN.
  CLEAR: gv_lang. gv_lang = sy-langu.
  CASE sscrfields.
    WHEN 'DE'.
      SET LOCALE LANGUAGE 'D'.
    WHEN 'EN'.
      SET LOCALE LANGUAGE 'E'.
    WHEN 'FR'.
      SET LOCALE LANGUAGE 'F'.
    WHEN 'RU'.
      SET LOCALE LANGUAGE 'R'.
    WHEN 'PL'.
      SET LOCALE LANGUAGE 'L'.
    WHEN 'DA'.
      SET LOCALE LANGUAGE 'K'.
    WHEN 'SV'.
      SET LOCALE LANGUAGE 'V'.
    WHEN 'CS'.
      SET LOCALE LANGUAGE 'C'.
    WHEN OTHERS.
      SET LOCALE LANGUAGE 'E'.
  ENDCASE.

  CALL FUNCTION 'ABAP4_CALL_TRANSACTION'                  "#EC CI_SUBRC
*    STARTING NEW TASK 'NEW'
    DESTINATION 'NONE'
    EXPORTING
      tcode                   = 'ZLECI'
    EXCEPTIONS
      call_transaction_denied = 1
      tcode_invalid           = 2
      OTHERS                  = 3.
  IF sy-subrc = 0.
    "Do nothing
  ENDIF.
  IF gv_lang IS NOT INITIAL.
    SET LOCALE LANGUAGE gv_lang.
  ENDIF.

The problem is when it goes inside the other Tcode when ABAP4_CALL_TRANSACTION is called at first it updates the language but it fails to update it next time.

FredericGirod
Active Contributor

I never do this, but I find this blog, if it could help

https://blogs.sap.com/2017/01/13/logon-language-sy-langu-and-rfc/

Sandra_Rossi
Active Contributor

Please edit your question, select your code and press the "CODE" button to make it correctly colorized/indented, so that it's easier for us to analyze it. Thank you.

Accepted Solutions (0)

Answers (0)