SAP SET COUNTRY ABAP Statements



Get Example source ABAP code based on a different SAP table
  


ID SET-COUNTRY
• SET COUNTRY ABAP Statement

SET COUNTRY
Short Reference

ABAP_SYNTAX
SET COUNTRY cntry.

What does it do?
This statement sets the formatting settings of the language environment for all subsequent statements of the current ABAP_ISESS .
cntry expects a character-like data object that either contains a value from the column LAND of the database table T005X or is initial.
If cntry contains a value from the table T005X, the number format, date format, time format, and time stamp format are set to a country-specific format in accordance with the entries in columns XDEZP, DATFM, and TIMEFM.
If cntry is initial, or, more specifically, it contains a blank in the first position, the formatting is set in accordance with the Defaults in the user master record.
If the content of cntry cannot be found in the database table T005X nor contains a blank in the first position, sy-subrc is set to 4 and the following settings are made:
The decimal separator is a decimal point and the thousands separator is a comma.
Date in the form mm/dd/yyyy
Time in 24-hour format
Time stamp according to the settings for date, time, and decimal separator
System Fields sy-subrcMeaning 0The specified country key was found in the database table T005X or a space was specified. 4The specified country key was not found in database table T005X .



Latest notes:

As long as the statement SET COUNTRY is not executed in an ABAP_ISESS , the formatting is set according to the Defaults in the user master record.
If certain formatting settings are only required for one or a few formattings, the formatting option country can be used for embedded expressions in string templates instead of SET COUNTRY .
The statement SET COUNTRY must not be confused with the obsolete addition COUNTRY of the statement SET LOCALE LANGUAGE, used for setting the text environment. In particular, there is no corresponding GET COUNTRY statement.
ABAP_HINT_END



Example ABAP Coding

Setting of the formatting settings of the language environment and their effect on the addition ENVIRONMENT in embedded expressions in string templates.
ABEXA 00647
ABAP_EXAMPLE_END

ABAP_EXAMPLES_ABEXA
String Templates, Formatting Settings
WRITE, Truncation Behavior
ABAP_EXAMPLE_END

Return to menu