Skip to Content

ABAP Geek 7 –Babylonian confusion?

ABAP language settings. The statements and what they do.

You might know, that there is set of very similar statements that deal with ABAP language settings. But do you know what these statements really do?

The statements are:

  • SET LANGUAGE …
  • SET  LOCALE LANGUAGE …
  • SET COUNTRY …

The syntax of the second statement appears to be a mixture of the syntax of the other two statements. So you might easily mix up all that statements in your mind. Beware of that. Each statement has a different purpose! This Blog tells you about it.

Loading a Text Pool with SET LANGUAGE

The syntax of SET LANGUAGE could rather be LOAD TEXTPOOL OF LANGUAGE because that is exactly what it does.

SET LANGUAGE lang.

This statement loads the list headers and text symbols of the text pool specified in language lang. A text pool is a component of an ABAP program, that contains the text elements of the program. For one program, multiple text pools in several languages can be defined. When you load a program into an internal session, the text elements of the text pool of the logon language are read in by default. During program execution, you can load the text pool of a different language with the statement SET LANGUAGE. After loading the text pool of a language, the program uses the text elements of this language. The text pool is relevant only for the current program, not for other programs of the same internal session.

Setting the Text Environment with SET LOCALE

The text environment is part of the runtime environment of an ABAP program and is made up of a language, a locale and a system codepage. All programs in an internal session have a common
text environment. As a default, the text environment of an internal session is determined by the logon language and can be set at runtime by the statement SET LOCALE. The language of the current text environment is contained in the system field sy-langu.

SET LOCALE LANGUAGE  lang .

This statement defines the text environment (language and locale) for all programs of the current internal session for the languages specified in lang, and sets sy-langu to this value. The statement has two obsolete additions COUNTRY and MODIFIER that should no longer be used.

The text environment modifies the following:

  • How internal tables and extracts are sorted using the statement SORT with the addition AS TEXT and the statement CONVERT TEXT
  • The additions LEGACY and NON-UNICODE of the statement OPEN DATASET,
  • Any behavior that depends on the content of sy-langu

Setting Country-Specific Formats with SET COUNTRY

The country-specific formatting settings for numbers, dates, and times are part of the formatting settings of the language environment determine that determine

  • the number format (decimal and thousand separators)
  • the date format (separators and order)
  • and the time format (24 hour or 12 hour format)

for formatted Output.

SET COUNTRY cntry.

This statement sets the formatting settings of the language environment for all following statements of the current internal session. If cntry contains a value from the table T005X, the number format, date format, and time format are set to a country-specific format in accordance with the entries in columns XDEZP, DATFM, and TIMEFM.

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply