ABAP Keyword Documentation → ABAP − Reference → Language Environment → Language Settings
Text Environment Language and Text Environment
Other versions: 7.31 | 7.40 | 7.54Text Environment Language
The text environment language is part of the language settings of an ABAP program and determines its text environment. It is valid during an internal session.
- The text environment language is set at the start of each internal session to the logon language of the current user session.
- It can also be set to a different language for the current internal session using the statement
SET LOCALE LANGUAGE
.
The current text environment language can be determined using the method GET_LANGUAGE of the class
CL_ABAP_SYST or using the statement GET
LOCALE LANGUAGE, and is the nominal content of the system field
sy-langu
. The possible single-character abbreviations for the text environment
language are stored as language keys in the column SPRAS of the database table T002.
Example
Asserts that the system field sy-langu
contains the current text environment language, An exception is raised if the system field is overwritten in the program.
ASSERT sy-langu = cl_abap_syst=>get_language( ).
Text Environment
All programs in an internal
session run in a shared text environment determined by the text environment language and which can
also be set using the statement SET LOCALE LANGUAGE
. As well as the language, the text environment comprises the following:
- A code page
- A locale
The text environment handles texts in character-like data objects:
- The code page of the text environment affects all operations that depend on the current character set, such as
- Casting character-like data objects to byte-like types
- Transferring data from and to external storage
- Transferring data using data and communication interfaces
- The locale of the text environment affects all statements that sort character-like data objects as text, such as
- In addition, the text environment language, and not the logon language, is used in the following cases:
- The ABAP-specific session variable LOCALE_SAP in SAP HANA and the session variable system_language in ABAP CDS contain the current text environment language in reads from ABAP or ABAP SQL.
- If the logon language for the RFC session is not defined in the RFC destination in a remote function call, it is determined by the current text environment language.
- If a language is not specified explicitly in the statement
SUBMIT VIA JOB
, the logon language of the background session is set implicitly to the current text environment language.
- The texts on selection screens are determined by the current text environment language.
- The exception texts returned by exception classes are determined by the current text environment language.
sy-langu
access the current text environment language and not the logon language.
Notes
- The ABAP programming language supports a subset covered by UCS-2 and not the full UTF-16 set. This contains all UTF characters except those in the surrogate area. ABAP interprets a character from the surrogate area as two characters.
- In the non-Unicode single code page systems supported before release 7.50, the code page of the text environment was always the non-Unicode system code page of the current AS Instance. It was possible to configure different system code pages for the code page of the text environment of a system only in the MDMP systems supported before Release 7.0.
Example
Sets the text environment explicitly before an aRFC. The function module DEMO_RFM_CALL_TRANSACTION calls a transaction using a transaction code passed to it. The logon language of the RFC session is not determined by the logon language of the current session and is always English. Afterwards, the text environment language is set back to its previous value.
GET LOCALE LANGUAGE DATA(langu)
COUNTRY DATA(dummy)
MODIFIER dummy.
SET LOCALE LANGUAGE 'E'.
CALL FUNCTION 'DEMO_RFM_CALL_TRANSACTION'
STARTING NEW TASK 'TCODE'
EXPORTING
tcode = 'SE11'.
SET LOCALE LANGUAGE langu.