cancel
Showing results for 
Search instead for 
Did you mean: 

iIs it possible to get logon language in the system variable similar to sy-langu in ABAP ?

Former Member
0 Kudos

Hello All,

We already know that by using this we can get the system lang --

SESSION_CONTEXT('LOCALE_SAP')

But I want to have this information as a calculated column in analytical view so that I can filter my table based on this.

Please help me .

Regards,

Sharath

Accepted Solutions (0)

Answers (1)

Answers (1)

lbreddemann
Active Contributor
0 Kudos

Hello Sharath,

I don't think that you actually want the logon language to be part of your table.

What you want to do - or what would make sense here - is: you want to filter your data, based on the logon language settings of the current session.

That's easy to have. Just implement a filter for a language column (single character) that equals to "$$language$$".

That's how e.g. text joins work.

- Lars

Former Member
0 Kudos

Yes. I have a table which has data and text fields in multiple languages. Ideally the table and text table are seperate entities but in my case both the values and the corresponding texts are in the same table.

I want to apply filter based on logon language. But how do i know the logon language ?

lbreddemann
Active Contributor
0 Kudos

Hi again,

as I wrote, you'd use the system variable $$language$$.

That's all. After activation, you can query the view without any additional settings:

select session_context('LOCALE_SAP'), session_context('LOCALE') from dummy;

/*

SESSION_CONTEXT('LOCALE_SAP') SESSION_CONTEXT('LOCALE')

D de                      

*/

SELECT TOP 5

"MATNR","SPRAS","MAKTX","MAKTG","MANDT"

FROM

"_SYS_BIC"."lars/AT_LANGDEPTEXT";

/*

MATNR   SPRAS   MAKTX                   MAKTG                   MANDT

T-FUC09 D       Flatscreen MS 1460 P    FLATSCREEN MS 1460 P    800 

T-FUC10 D       Flatscreen MS 1460 P    FLATSCREEN MS 1460 P    800 

T-FUC11 D       Flatscreen MS 1460 P    FLATSCREEN MS 1460 P    800 

T-FUC12 D       Flatscreen MS 1460 P    FLATSCREEN MS 1460 P    800 

T-FUC13 D       Flatscreen MS 1460 P    FLATSCREEN MS 1460 P    800 

*/

--> connect with english locale

select session_context('LOCALE_SAP'), session_context('LOCALE') from dummy;

/*

SESSION_CONTEXT('LOCALE_SAP') SESSION_CONTEXT('LOCALE')

E en                      

*/

SELECT TOP 5

"MATNR","SPRAS","MAKTX","MAKTG","MANDT"

FROM

"_SYS_BIC"."lars/AT_LANGDEPTEXT";

/*

MATNR   SPRAS   MAKTX                   MAKTG                   MANDT

100-110 E       Slug for spiral casing  SLUG FOR SPIRAL CASING  800 

100-300 E       Hollow shaft            HOLLOW SHAFT            800

100-302 E       Hollow shaft            HOLLOW SHAFT            800

102-300 E       Hollow shaft            HOLLOW SHAFT            800

T-BQ500 E       Hollow shaft            HOLLOW SHAFT            800

*/

Easy as pie, isn't it? 🙂

- Lars

former_member228410
Discoverer
0 Kudos

Hi,

Is there a corresponding system variable that will get the language with 2 letters instead of 1?

Also, is it possible to specify the system variable in a filter expression for a calculation view instead of a simple filter as the one included in an attribute view?

Thanks,

Madalina

lbreddemann
Active Contributor
0 Kudos

Madalina,

this question has been explained and answered already multiple times here in SCN.

Searching for it is not a crime!

Anyhow: LOCALE => iso-code language, LOCALE_SAP => SAP encoding (both set automatically based on user parameter or logon parameter).

Filtering in information models is easily done by variable $$language$$.

Alright, and from now on I am not going to answer this question again .

- Lars

Former Member
0 Kudos

Hi Lars,

We have a requirement to display language specific description for calculation views.

When checking the table _sys_repo.active_object_text_content the lang column had the language specific information

but the language code was stored in ISO 639 format. (en, de...).

From the query select session_context('locale') from dummy i am able to get the language code in posix format (en_US..)

How would i fetch the language specific description from the above mentioned table using the locale information from the session.

Thanks in advance!

Best Regard

Cherry

lbreddemann
Active Contributor
0 Kudos

Hi Cherry,

actually LOCALE does not provide the locale information in POSIX format, but in whatever format was specified during logon by the client app.

For SAP HANA Studio this is a JAVA (Locale (Java Platform SE 7 ) which is mostly in the form of <lang>_<country> (e.g. en_US).

The SAP HANA contents are saved with just the language code provided (two or three letters).

This means, you could simply do a substring and use only the language part of your LOCALE settings.

Besides that, I am not too sure about your requirement. Why do you think it's necessary to access internal repository tables? Had you have a look into the translation tools for the repository objects (rtt folder in your SAP HANA client installation)?

- Lars