Ansicht
Dokumentation

ABENTEXT_ENVIRONM_GUIDL - TEXT ENVIRONM GUIDL

ABENTEXT_ENVIRONM_GUIDL - TEXT ENVIRONM GUIDL

CPI1466 during Backup   Fill RESBD Structure from EBP Component Structure  
This documentation is copyright by SAP AG.
SAP E-Book

Text Environment

The text environment is part of the runtime framework of an ABAP program and is made up of a text environment language, a locale, and a system code page. All programs in an internal session have a common text environment.

By default, the text environment of an internal session is determined by the logon language and can be set programmatically by the statement SET LOCALE LANGUAGE. The current text environment language is contained in the system field sy-langu and is returned by the method GET_LANGUAGE of the class CL_ABAP_SYST.

If possible, do not switch the text environment within the code

Set the statement SET LOCALE LANGUAGE in exceptional cases only, and reverse any text environment switches in good time.

ABAP-coded services usually expect the text environment to be specified by the current user's logon language. The services are not designed to handle text environment switches of internal sessions within the code.

If the text environment has to be switched for a specific service due to the following exceptions, this must be done only temporarily. This means that a switched text environment must be reset within the same program context to prevent unexpected behavior in other programs within the same internal session.

Exception

Switching the text environment within the code may be necessary in the following cases:

  • For accessing external files

The following source code shows a text environment switch within a method, where the text environment is not reset before exiting the method. This poses the danger of continuing within the wrong text environment after returning from the method.

METHOD ...
   SET LOCALE LANGUAGE ...
   ...
ENDMETHOD.

The following source code shows a text environment switch within a method, where the text environment is reset to its original state before exiting the method.

METHOD ...
  DATA env_lang TYPE tcp0c-langu.
  GET LOCALE LANGUAGE env_lang.
  SET LOCALE LANGUAGE ...
  ...
  SET LOCALE LANGUAGE env_lang.
ENDMETHOD.






General Material Data   General Material Data  
This documentation is copyright by SAP AG.

Length: 3164 Date: 20240425 Time: 131749     sap01-206 ( 57 ms )