Ansicht
Dokumentation

ABENUNICODE_LIST - UNICODE LIST

ABENUNICODE_LIST - UNICODE LIST

Addresses (Business Address Services)   ABAP Short Reference  
This documentation is copyright by SAP AG.
SAP E-Book

Lists in Unicode Systems

Introduction

A WRITE statement writes the content of data objects to a list. When data is written with a WRITE statement, the output is stored in the list buffer and accessed from there for display when the list is called.

Each time a data object is produced by WRITE, the system defines an output length either implicitly or explicitly; the implicit output length depends on the data type. The output length defines the following two attributes:

  • Number of positions or memory spaces available for characters in the list buffer
  • Number of columns or cells available in the actual list

If the output length is shorter than the length of the data object, the system shortens its content according to certain rules when writing the data to the list buffer. Any values lost in numeric fields are indicated by a *.

When displaying or printing a list, the content stored in the list buffer is transferred to the list as follows:

  • In non-Unicode systems, each character occupies the same amount of space in the list buffer as it requires columns in the list. In single-byte systems, a character occupies one byte in the list buffer and one column in the list, while a character that occupies several bytes in the list buffer in multi-byte systems also occupies the same number of columns in the list. For this reason, all the characters stored in the list buffer are displayed in the list in non-Unicode systems.
  • In Unicode systems, every character usually occupies one place in the list buffer. However, a character can also occupy more than one column, as is the case for Eastern Asian characters. However, since the list only contains the same number of columns as there are positions in the list buffer, the number of characters that can be displayed in the list is smaller than the number of characters stored in the list buffer in this case. List output is shortened accordingly, with the page formatted according to the specified alignment and marked with the characters > or <. You can then only display the entire content of the list by choosing the menu path System → List → Unicode Display.

For this reason, the horizontal position of the list cursor only has the same meaning as the output column in a list displayed or printed in non-Unicode systems. In Unicode systems, this is only guaranteed for the top and bottom output limits.

Rules for WRITE Statements

To avoid cutting off values unintentionally as far as possible, the rules for WRITE statements in Unicode programs have been modified and extended.

Operands in the WRITE Statement

If the data object specified in WRITE is a flat structure, this must be purely character-like in Unicode programs.

Note

This also applies for the statement WRITE TO, in which the target field must also be character-like.

WRITE Statements with Implicit Output Length

In Unicode programs, WRITE statements without an explicitly specified output length for all data objects except text field literals and data objects of the type string behave in the same way as in non-Unicode programs. This means fewer characters may be displayed in the list than are stored in the list buffer.

In the case of text field literals and data objects of the type string, the system assumes that all characters are to be displayed. For this reason the implicit output length is calculated using the characters contained in the data object so that it corresponds to the number of columns needed in the list. If this output length is greater than the length of the data object, surplus positions are filled with blanks when the data is written to the list buffer. When displaying the data in the list, the system removes these blanks, since the character representation fills the output length exactly.

WRITE Statements with Explicit Output Length

If a numeric data object is specified as an explicit output length after the AT addition for a WRITE statement, the value of this number is used as the output length, both in Unicode and non-Unicode systems. In Unicode systems, the number of characters displayed in the list can differ from the number of characters stored in the list buffer. You can specify the output length in the following way instead of using numeric data objects:

  1. WRITE AT (*) ...
    1. In data objects of the types c and string, the output length is set to the number of columns required to display the entire content in the list; closing blanks are ignored for type c. In the case of data objects of the type string, this has the same meaning as the implicit length.
    2. In data objects of the types d and t, the output length is set to 10 and 8.
    3. In data objects of the numeric types i, f, and p, the output length is set to the value required to display the current value including thousand separators. This rule is applied to the value after any CURRENCY, DECIMALS, NO-SIGN, ROUND, or UNIT have been used.
    4. The implicit output length is used for data objects of the types n, x, and xstring.

  2. WRITE AT (**) ...
    1. In data objects of the type c, the output length is set to twice the length of the data object, and in data objects of the type string, to twice the number of characters contained in the object.
    2. In data objects of the types d and t, the output length is set to 10 and 8.
    3. In data objects of the numeric types i, f, and p, the output length is set to the value required in order to display the maximum possible values for these types, including plus and minus signs and thousands separators. This rule is applied to the value after any CURRENCY, DECIMALS, NO-SIGN, ROUND, or UNIT additions have been used.
    4. The implicit output length is used for data objects of the types n, x, and xstring.

The behavior of the output lengths (*) and (**) when using the addition USING EDIT MASK and the templates for date fields is described in Formatting Options.

Additions for GET/SET CURSOR FIELD/LINE

The additions DISPLAY OFFSET and MEMORY OFFSET take account of the fact that data objects can occupy different lengths when displayed in a list and when stored temporarily in the list buffer.

In accordance with this fact, the addition DISPLAY OFFSET off positions the cursor in the column in the output area specified in off for the SET CURSOR { FIELD f | LINE l } statement. The addition MEMORY OFFSET off positions the cursor on the character in the output area that is located in the position (of the data object in f) in the list buffer specified in off.

In the same way, a GET CURSOR { FIELD f | LINE l } statement used with the addition DISPLAY OFFSET off places the cursor position in the output area in the data object off. When you use the addition MEMORY OFFSET off, the cursor position in the list buffer that is assigned to the character displayed is placed in the data object off. The DISPLAY addition is the default and can be left out.

Class for Formatting Lists

Class CL_ABAP_LIST_UTILITIES has been introduced to calculate output lengths, convert values from the list buffer, and define field limits. The return codes of the methods of this class can be used to program a correct column alignment in ABAP lists, even for output of Eastern Asian characters.

List Settings

The objects in a list can be displayed in different output lengths by specifying the desired length in the menu under System → List → Unicode Display. This is particularly advantageous for screen lists in Unicode systems where the output is cut off as indicated by the characters > or <.

Recommendations

We recommend that you adhere to the following rules when programming lists, to ensure that they have the same appearance and functions both in Unicode and non-Unicode systems:

  • Specify an adequate output length
  • Do not overwrite parts of a field
  • Do not use the additions RIGHT-JUSTIFIED or CENTERED for WRITE TO if this statement is followed by list output with WRITE.
  • In customer-programmed horizontal scrolling with a SCROLL statement, you should only specify the upper or lower limit of data objects displayed, since the positions in the list buffer and in the list displayed are only certain to match for these field limits in Unicode systems.





ABAP Short Reference   CPI1466 during Backup  
This documentation is copyright by SAP AG.

Length: 10951 Date: 20240425 Time: 132719     sap01-206 ( 203 ms )