Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  Program Parameters →  Language Environment →  Text Environment 

Set Text Environment

This example demonstrates how you set the text environment.

Other versions: 7.31 | 7.40 | 7.54

Source Code

    DATA text_tab TYPE HASHED TABLE OF string
                       WITH UNIQUE KEY table_line.
    INSERT: `polo`    INTO TABLE text_tab,
            `pollo`   INTO TABLE text_tab,
            `chunky`  INTO TABLE text_tab,
            `crunchy` INTO TABLE text_tab.
    SET LOCALE LANGUAGE 'E'.
    SORT text_tab AS TEXT.
    cl_demo_output=>write( text_tab ).
    SET LOCALE LANGUAGE 'S'.
    SORT text_tab AS TEXT.
    cl_demo_output=>write( text_tab ).
    SET LOCALE LANGUAGE ' '.
    cl_demo_output=>display( ).

Description

This example shows the effect of the locale of the text environment on sort functions. In Unicode and non-Unicode systems, a "ch" in a Spanish (or even Czech) text environment is taken as a single letter and sorted differently than in an English text environment. The double "ll" in Unicode systems in a Spanish text environment is sorted like two separate letters "l". In non-Unicode systems, there can be spanish locales (such as Spanish_Spain.1252 on Windows NT) that take "ll" as a single character and sort it differently. With the last statement SET LOCALE, the text environment is set again to the logon language.