... [LEFT-JUSTIFIED|CENTERED|RIGHT-JUSTIFIED]
[NO-GAP]
[UNDER other_dobj]
{ { [EXPONENT exp]
[NO-GROUPING]
[NO-SIGN]
[NO-ZERO]
[CURRENCY cur]
{ { [DECIMALS dec]
[ROUND scale] }
| [UNIT unit] } }
| [TIME ZONE tz] }
[USING { {NO EDIT MASK}|{EDIT MASK mask} }]
[ DD/MM/YY | MM/DD/YY
| DD/MM/YYYY | MM/DD/YYYY
| DDMMYY | MMDDYY
| YYMMDD ] ... .
1. ... LEFT-JUSTIFIED|CENTERED|RIGHT-JUSTIFIED
2. ... NO-GAP
3. ... UNDER other_dobj
4. ... EXPONENT exp
5. ... NO-GROUPING
6. ... NO-SIGN
7. ... NO-ZERO
8. ... CURRENCY cur
9. ... DECIMALS dec
10. ... ROUND scale
11. ... UNIT unit
12. ... TIME ZONE tz
13. ... USING { {NO EDIT MASK}|{EDIT MASK mask} }
14. ... DD/MM/YY | MM/DD/YY
| DD/MM/YYYY | MM/DD/YYYY
| DDMMYY | MMDDYY
| YYMMDD
These format options override the predefined settings. Without the specification of these additions, the output format depends implicitly on the data type. The result of formatting is adjusted to match the output length. If, during output, a conversion routine is executed, all the formatting options - except for NO-GAP and UNDER - are ignored.
The additions can be used together with the following limitations:
... LEFT-JUSTIFIED|CENTERED|RIGHT-JUSTIFIED
This addition defines whether the output formatted according to the other options is aligned left-justified, centered, or right-justified outside the current output length in the list buffer. Closing blanks are ignored in the case of fields of the type c and they are treated like the other characters in the case of fields of type string.
The alignment takes place in that the superfluous positions in the list buffer are filled up either right-justified, or left-justified, or alternating right and left. If the output length is not sufficient, the characters are cut off to the right for left-justified and centered, and to the left for right-justified alignment.
If the output length in the list display is not sufficient in
Unicode systems, characters are cut
off during transfer of data from the list buffer into the list. They are cut off to the right for left-justified,
and to the left for right- justified output. In the case of centered output, blanks are removed in alternating
fashion on both sides, whereby the cut-off starts on the side with more blanks, and then the other characters
on the right side. If, during data transfer from the list buffer into the list, characters are cut off,
this is made visible on the left side with the character < and on the right side with the character >.
Output of three literals left, in the middle, and to the right of an output area 60 characters in length.
WRITE: /(60) 'Left' LEFT-JUSTIFIED,
/(60) 'Center' CENTERED,
/(60) 'Right' RIGHT-JUSTIFIED.
... NO-GAP
The list cursor is positioned directly after the output and not in the position in the list buffer after the next one.
The output for both WRITE statements is " NoGap".
WRITE: 'No' NO-GAP, 'Gap'.
... UNDER other_dobj
The output takes place in the current line at the position where, in a previous WRITE statement, the data object other_dobj was output. The data object other_dobj must be written in the same way as in the respective WRITE statement - that is, including possible offset/length specifications, and so on. if the data object other_dobj was not specified beforehand, the addition is ignored.
The addition UNDER cannot be used together with a position
specification pos after AT.
Vertical positioning must be taken care of. If the list cursor is at the same position as the output of other_dobj, this will be overwritten.
Table-type output of flight connections.
DATA: carrid TYPE spfli-carrid,
connid TYPE spfli-connid.
WRITE: 10 'Carrier', 40 'Connection'.
ULINE.
SELECT carrid connid
FROM spfli
INTO (carrid,connid).
WRITE: / carrid UNDER 'Carrier',
connid UNDER 'Connection'.
ENDSELECT.
... EXPONENT exp
This addition cannot be used together with the addition TIME ZONE.
This addition defines the exponent for output of data objects of the data type
f. For all other data types, the addition is ignored. For exp,
a data object of the type i is expected that contains
the required exponent. The mantissa is adjusted by moving the decimal point and inserting zeroes to
the exponent. If exp contains the value 0, no exponent
is output. If the value of exp is larger than the exponent
in dobj plus 16, only zeroes are displayed in the mantissa.
If the value of exp is less than the exponent in
dobj and the output length is not sufficient for the required positions bfore the decimal
separator, the addition is ignored. If the value in exp is positive and more than three digits, only the first three positions of the exponent are displayed.
The output of the WRITE statement is "1,414". The standard output for an output length of 6 would be "1E+00".
DATA float TYPE f.
float = sqrt( 2 ).
WRITE (6) float EXPONENT 0.
... NO-GROUPING
This addition cannot be used together with the addition TIME ZONE.
This addition suppresses the thousands separator in the output of data objects of data types
i or p. In all other data types, the addition is ignored.
... NO-SIGN
This addition cannot be used together with the addition TIME ZONE.
This addition suppresses the plus/minus sign in the output of data objects of data types i, p, or f. In all the other data types, the addition is ignored.
If the addition NO-SIGN is used with the length specification
* or **
after AT, it is used first and the output length is determined from the result.
Output with red background color instead of with a plus/minus sign.
DATA number TYPE i.
DO 10 TIMES.
number = sy-index - 5.
IF number < 0.
WRITE number NO-SIGN COLOR = 6.
ENDIF.
ENDDO.
... NO-ZERO
This addition cannot be used together with the addition TIME ZONE.
If dobj has a numeric data type and contains the value
0, blanks are output for the length of the output. If dobj
has the data type c, n,
or string, leading zeroes are displayed by blanks.
Output of 22 blanks with red background color instead of the standard output "0,0000000000000000E+00".
DATA float TYPE f.
SET BLANK LINES ON.
IF float = 0.
WRITE float NO-ZERO COLOR = 6.
ENDIF.
... CURRENCY cur
This addition cannot be used together with the addition TIME ZONE.
This addition defines currency-dependent decimal places for the output of data objects of data types i or p. For all other data types, except for f, the addition is ignored. For cur, a three-digit, character-type field is expected that contains a currency key from the column CURRKEY of the database table TCURX in uppercase letters. The system determines the number of decimal places from the column CURRDEC of the respective row in the database table TCURX. If the content of cur is not found in TCURX, two decimal places are used. The following applies for numeric data types:
If the addition CURRENCY with length specification * or ** is used after AT, it is used first and the output length is determined from the result.
The addition CURRENCY is appropriate for the display of
data objects of type i or
p without decimal places, whose contents are currency amounts in the smallest unit of the currency.
The output of the WRITE statement is "123456,78".
DATA int TYPE i VALUE 12345678.
WRITE int NO-GROUPING CURRENCY 'EUR'.
... DECIMALS dec
This addition cannot be used together with the addition TIME ZONE.
This addition defines the number of displayed decimal places for the output of data objects of data types i, p, or f. For all other data types, the addition is ignored. For dec, a data object of type i is expected that contains the number of required decimal places. If the content of dec is less than 0, it is treated as 0, whereby the content of data objects of data types i or p is previously multiplied by 10 to the power of dec. For the individual numeric data types, the following applies:
If the addition DECIMALS is used with length specification * or ** after AT, it is used first and then the output length is determined from the result.
If the addition CURRENCY is specified as well, this is
executed first in the case of data types i and
p, and then the addition DECIMALS is applied.
In the case of data type f, the addition
CURRENCY is ignored if it is specified together with DECIMALS.
The output for the WRITE statement is "1234,57".
DATA pack TYPE p LENGTH 8 DECIMALS 4 VALUE '1234.5678'.
WRITE pack NO-GROUPING DECIMALS 2.
... ROUND scale
This addition cannot be used together with the addition TIME ZONE.
If dobj has the data type p, this addition multiplies the value of the data object, before output, by 10 to the power of scale. In all other data types, the addition is ignored. For scale, a data object of type i is expected that contains the value of the required scale.
If the value of scale is greater than 0 and the addition DECIMALS is not specified, the interim result is rounded to the number of decimal places defined in the data type. If the addition DECIMALS is specified, it is rounded to the number of decimal places specified in dec and these are then output.
If the addition ROUND is used with the length specification * or ** after AT, it is used first and the output length is determined from the result.
If the addition CURRENCY is specified, this is used, before
multiplication, for the content of dobj. If the addition
DECIMALS is not specified, the number of decimal places
specified through cur is used for rounding off and for
the output. If the addition DECIMALS is specified, the value in dec is used.
The output of the WRITE statement is "123456,7800".
DATA pack TYPE p VALUE '12345678'.
WRITE pack NO-GROUPING ROUND 2 DECIMALS 4.
... UNIT unit
This addition cannot be used together with the addition TIME ZONE.
This addition cuts off decimal places that have the value 0 and are outside the exactness of a unit of measure during output of data objects of data type p. For all other data types, except f, this addition is ignored. For unit, a three-digit, character-type field is expected that contains a unit key from the column MSEHI in the database table T006 in uppercase letters. The system determines the number of decimal places from the column DECAN in the corresponding row in the database table T006. If the content of unit is not found in T006, the addition is ignored.
If the addition UNIT is used with the length specification * or ** after AT, it is used first, and the output length is determined from the result.
If the addition CURRENCY is used at the same time, this
is used first for data type p and then the addition
UNIT is used. In the case of data type f, the addition UNIT is ignored.
If no decimal places are specified for the number "PC" in T006, the output of the WRITE statement is "1234".
DATA pack TYPE p DECIMALS 4 VALUE '1234.0000'.
WRITE pack NO-GROUPING UNIT 'PC'.
... TIME ZONE tz
This addition edits a time stamp in relation to a time zone. The data object dobj must be of type p of length 0 without decimal places, or of type p of length 11 with seven decimal places. The content of dobj is interpreted in such a way as if it contained the long or the short form of a time stamp in UTC reference time.
For tz, a data object of type TIMEZONE from the ABAP Dictionary must be specified. It must contain a time zone from the column TZONE of the database table TTZZ in uppercase letters. If tz is initial, the UTC reference time is output.
The time stamp in dobj is converted to the time zone given in tz, and edited as follows from the left:
The editing takes place in an interim result of length 19 if the time stamp is in its short form or
of length 27, or if the time stamp is in the long form. If the output length is shorter than 19 or 27,
respectively, first all the separators in date and time are removed in the interim result, then the
blanks between date and time, and only then characters are cut off at the right. If, at the same time,
a date mask date_mask is specified, the separators in the date are not removed.
The data objects dobj and
tz can be declared in relation to data types TIMESTAMP, TIMESTAMPL, and TIMEZONE in the ABAP Dictionary.
Output of a UTC time stamp in Tasmanian time. In daylight-saving time, the output is "28.06.2002 04:00:00".
DATA: time_stamp TYPE timestamp,
tzone TYPE timezone.
time_stamp = 20020627180000.
tzone = 'AUSTAS'.
WRITE / time_stamp TIME ZONE tzone.
... USING { {NO EDIT MASK}|{EDIT MASK mask} }
This addition overrides a conversion routine defined through reference to the ABAP Dictionary. The addition NO EDIT MASK only switches off the execution of an assigned conversion routine. The addition EDIT MASK calls either another conversion routine or defines an edit mask. For mask, a data object of the same name is expected.
In order to call an arbitrary conversion routine CONV, mask must contain two equals signs, followed directly by the name of the conversion routine: "==CONV". During output, the content of dobj is passed to the function module CONVERSION_EXIT_CONV_OUTPUT, converted there, and then the result is displayed. If the function module is not found, an exception that can be handled is triggered (as of Release 6.10). The statement DESCRIBE FIELD contains an addition in order to fill mask accordingly.
If the output length is specified explicitly with len, the conversion routine is executed for the specified length; otherwise for the implicit output length. If * or ** is specified for the output length, the appropriate rules are used for the converted result.
If the first two characters in mask are not equals signs, the content is interpreted as an edit mask in which some characters have a particular meaning. The WRITE statement does not then output the content of dobj directly, but the character string in mask as follows:
If no output length is specified, the implicit output length of dobj is used. If len is specified for the output length, the value of len is used. If * is specified for the output length, exactly that length that is required for the list display is set. If, in Unicode systems, characters of the edit mask are replaced by characters that take up more than one column on the list, the output length is increased accordingly and the output is filled with blanks in the list buffer. If ** is specified for the output length, double the length of the edit mask mask is used.
If other formatting options are specified concurrently for an edit mask, these are used first and then
the special characters in the edit mask are replaced by the interim result. The date masks
date_mask are an exception to this. If these are specified, the edit mask is ignored.
Edited output of time duration. In the first output, the function module CONVERSION_EXIT_DURA_OUTPUT is executed. This converts the duration specified in seconds into minutes. In the second output, the edit mask is output according to the above rules. However, the underscore characters "_" are replaced by the characters from time.
DATA: dura TYPE i,
time TYPE t VALUE '080000'.
dura = sy-uzeit - time.
time = dura.
WRITE /(30) dura USING EDIT MASK '==SDURA'.
WRITE /(30) time USING EDIT MASK
'RRThe duration is __:__:__'.
... DD/MM/YY | MM/DD/YY
| DD/MM/YYYY | MM/DD/YYYY
| DDMMYY | MMDDYY
| YYMMDD
The content of a data object of type d is interpreted as a valid date in the format YYYYMMDD and is output as follows for the individual additions:
If the output length is defined implicitly or specified using len,
this is used. If it is too short, the edited output is cut off to the right. If the output length is
specified using * or **, it is set to the length of the specified edit mask (6, 8, or 10).
The behavior for abbreviation differs from the output of a data in accordance with the user master record, where the separator is removed first and then cut off.
The output of the WRITE statement is, for example, "230402".
WRITE sy-datum YYMMDD.
Non-Catchable Exceptions