SET COUNTRY

Short Reference

Syntax

SET COUNTRY cntry.

Effect

This statement specifies the predefined output formats for the decimal format (selection of decimal separators and thousand separators) and the date format in all programs of the current internal session for all subsequent outputs in lists using the WRITE statement and all assignments using the WRITE TO statement. A character-type (prior to release 6.10: a flat data object is expected for cntry.

If the value specified in cntry exists as the country key in the column COUNTRY of the database table T005X, the output of numbers and dates is formatted according to the entries in columns XDEZP and DATFM. The following tables list the possible values in these columns and their meanings, where MM stands for the month, DD for the day, and YYYY for the year.

XDEZP Decimal separator Thousand separator
"X" "." ","
" " "," "."
"Y" "," " "

DATFM Date format
"1" DD.MM.YYYY
"2" MM/DD/YYYY
"3" MM-DD-YYYY
"4" YYYY.MM.DD
"5" YYYY/MM/DD
"6" YYYY-MM-DD

If a blank character precedes cntry, the decimal and date formats are changed to the default settings stored in the user master record for the current user under fixed values.

If the content of cntry is not found in the database table T005X and a blank character does not precede cntry, sy-subrc is set to 4 and the decimal separator is displayed as a period and the date is displayed using the format MM/DD/YYYY (month/day/year).

System fields

sy-subrc Meaning
0 The specified country key is found in the database table T005X and a blank character is specified.
4 The specified country key cannot be found in the database table T005X.

Note

The country names that belong to the country IDs in table T005X are contained in the table T005T.

Example

Display of all formats for decimal numbers and date specifications currently contained in the table T005X.

DATA: dat       TYPE sy-datum VALUE '20020127',
      num       TYPE p  LENGTH 8 DECIMALS 2 VALUE '1234567.89',
      t005x_wa  TYPE t005x,
      t005x_tab TYPE SORTED TABLE OF t005x
                WITH NON-UNIQUE KEY xdezp datfm.

SELECT *
       FROM t005x
       INTO TABLE t005x_tab.

DELETE ADJACENT DUPLICATES FROM t005x_tab.

LOOP AT t005x_tab INTO t005x_wa.
  SET COUNTRY t005x_wa-land.
  WRITE: / num, dat.
ENDLOOP.