SAP TEXT ENVIRONMENT



Get Example source ABAP code based on a different SAP table
  



Text Environment Language and Text Environment
ITOC

Text 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 ABAP_ISESS .
The text environment language is set at the start of each ABAP_ISESS to the logon language of the current user session.
It can also be set to a different language for the current ABAP_ISESS 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 ABAP Coding

Assurance 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.
ABEXA 01344
ABAP_EXAMPLE_END

Text Environment
All programs in an ABAP_ISESS work in a shared text environment that is 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 includes:
A code page The code page of the text environment is always the system code page UTF-16 of the ABAP_ASINSTANCES of a Unicode system and cannot be changed. The current release supports Unicode systems only. Text environments with other code pages are no longer supported. There is a special feature in which the non-Unicode code page that is used for conversions is the one that would be assigned to the current text environment in a non-Unicode system. This only applies to specific statements, such as reading and writing legacy files using the ABAP file interface.
A locale The locale properties that belong to the text environment language and country are defined in an ICU (International Components for Unicode) library. This library is made available for AS ABAP and is independent of the operating system of the host computer of the ABAP_ASINSTANCES .
The main purpose of the text environment it to handle 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
SORT AS TEXT
CONVERT TEXT INTO SORTABLE CODE
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 AB_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. Any further frameworks based on the nominal value of the system field sy-langu access the current text environment language and not the logon language.



Latest notes:

The ABAP programming language supports a subset covered by UCS-2 and not the full scope of UTF-16. 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 ABAP_762 , the code page of the text environment was always the non-Unicode system code page of the current ABAP_ASINSTANCE . 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 ABAP_RELEASE 7.0.
ABAP_HINT_END



Example ABAP Coding

Setting 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 always English, regardless of the logon language of the current session. Afterwards, the text environment language is set back to its previous value.
ABEXA 01345
ABAP_EXAMPLE_END