| Formatting Options You
can use various formatting options with the WRITE statement.
Syntax
WRITE .... <f> <option>.
Formatting options for all data types
| Option |
Purpose |
| LEFT-JUSTIFIED |
Output is left-justified. |
| CENTERED |
Output is centered. |
| RIGHT-JUSTIFIED |
Output is right-justified. |
| UNDER <g> |
Output starts directly under the field <g>. |
| NO-GAP |
The blank after the field <f> is omitted. |
| USING EDIT MASK <m> |
Specifies a format template <m>. |
| USING NO EDIT MASK |
Deactivates a format template specified in the ABAP/4 Dictionary. |
| NO-ZERO |
If a field contains only zeros, these are replaced by blanks. For
type C and N fields, leading zeros are replaced automatically. |
Formatting options for numeric fields
| Option |
Purpose |
| NO-SIGN |
The leading sign is not output. |
| DECIMALS <d> |
<d> defines the number of digits after the decimal point. |
| EXPONENT <e> |
In type F fields, the exponent is defined in <e>. |
| ROUND <r> |
Type P fields are multiplied by 10**(-r) and then rounded. |
| CURRENCY <c> |
Format according to currency <c> in table TCURX. |
| UNIT <u> |
The number of decimal places is fixed according to the unit <u>
specified in table T006 for type P fields. |
Formatting options for date fields
| Option |
Purpose |
| DD/MM/YY |
Separators as defined in user's master record |
| MM/DD/YY |
Separators as defined in user's master record |
| DD/MM/YYYY |
Separators as defined in user's master record |
| MM/DD/YYYY |
Separators as defined in user's master record |
| DDMMYY |
No separators. |
| MMDDYY |
No separators. |
| YYMMDD |
No separators. |
For more detailed information on formatting options and the exclusion
principles within some of these options, see the keyword documentation of the WRITE
statement.
Below are some examples of formatting options. The decimal character and
thousands separators (period or comma) of numeric fields are defined in the user's master
record

| ABAP/4 code |
Screen output |
DATA: G(5) VALUE 'Hello',
F(5)
VALUE 'Dolly'.
WRITE: G, F.
WRITE: /10 G, / F UNDER G.
WRITE: / G NO-GAP, F. |
Hello Dolly
Hello
Dolly
HelloDolly |
DATA TIME TYPE T VALUE '154633'.
WRITE: TIME,
/(8)
TIME USING EDIT MASK '__:__:__'. |
154633
15:46:33 |
WRITE: '000123',
/ '000123'
NO-ZERO. |
000123
123 |
DATA FLOAT TYPE F VALUE '123456789.0'.
WRITE FLOAT EXPONENT 3. |
123456.789E+03 |
DATA PACK TYPE P VALUE '123.456'
DECIMALS 3.
WRITE PACK DECIMALS 2.
WRITE: / PACK ROUND -2,
/ PACK
ROUND -1,
/ PACK
ROUND 1,
/ PACK
ROUND 2. |
123.46
12,345.600
1,234.560
12.346
1.235 |
WRITE: SY-DATUM,
/ SY-DATUM
YYMMDD. |
06/27/1998
980627 |
Apart from the formatting options shown in the above tables, you can
also use the formatting options of the FORMAT statement. These options allow you to
specify the intensity and color of your output. |



|