Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Change language of alv display based on parameter.

0 Kudos

So I am using cl_salv_table=>factory alv to display some data in an internal table to a user.

At the selection screen the user has the option to fill in a language parameter.

So for example if a user is logged with EN language, but fills DE for the parameter, I'd want to display the information from the alv in German - That includes the name of the columns and all the content in the fields.

Is this possible? Thank you.

2 REPLIES 2

Tomas_Buryanek
Active Contributor
0 Kudos

You can use SET LOCALE LANGUAGE command before the SALV factory method call.

Here are details in the ABAP help docu:

https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abapset_locale.htm

Do not forget to change language back after the SALV display 🙂

EDIT: I have to mention that according to programming guidelines: "Set the statement SET LOCALE LANGUAGE in exceptional cases only, and reverse any text environment switches in good time." ! Maybe someone knows better way to switch ALV output language.

-- Tomas --

0 Kudos

Not sure if it's a "better way", but it's a less intrusive one: play with the field catalog. If the selected language differs from the system's one, retrieve the field catalog and find a way to re-populate the texts with the selected language (I'm pretty sure there are DDIC functions to retrieve them).