SAP NetWeaver AS ABAP Release 750, ©Copyright 2016 SAP AG. All rights reserved.
ABAP - Keyword Documentation → ABAP - Reference → Text Repositories → Texts in Text Pools →
SET LANGUAGE
Syntax
SET LANGUAGE lang.
Effect
This statement loads the list headers and text symbols from the text pool in the language specified in lang. lang must be a character-like data object that contains a language key with the length 1. The possible language keys are contained in the SPRAS column of the database table T002. The loaded text elements are only valid for the current program and not for the programs called within it. If lang contains a space, the behavior is undefined.
If there is no text pool for the specified language, the system loads the text pool in the secondary language which is specified in the profile parameter zcsa/second_language. If a secondary language is not set, no new text pool is loaded and sy-subrc is set to 4. In this case, the program continues to use the text elements of the previous text pool.
If list headers and text symbols are missing in a text pool loaded using SET LANGUAGE but existed in the previously loaded text pool, these are initialized.
System Fields
sy-subrc | Meaning |
0 | The text pool of the specified language or secondary language was loaded. |
4 | Neither the text pool of the specified language nor the secondary language could be loaded. |
Notes
Example
Displays the text symbol text-010 in different languages. Output is produced for all languages for which the text pool exists in the specified language, or in the secondary language.
DATA langu LIKE sy-langu.
SELECT spras FROM t002
INTO @langu.
SET LANGUAGE langu.
IF sy-subrc = 0.
cl_demo_output=>write( |{ langu } { text-010 }| ).
ENDIF.
ENDSELECT.
cl_demo_output=>display( ).