Google Search - Blog...........

Formatting output in write statement of SAP ABAP

You can position the output of a WRITE statement on the screen by making a format specification before the field name as follows:

Syntax:

WRITE AT [/][][()] ,
Where

• ‘the slash’/‘ denotes a new line,
is a number or variable denoting the position on the screen,
is a number or variable long denoting the output length.

For variables you need to mention the AT, for direct values it is not necessary.

DATA: LEN TYPE I VALUE 10,
POS TYPE I VALUE 11,
TEXT (10) VALUE ‘1234567890’
WRITE AT POS (LEN) TEXT.

This produces the following output on the screen;
The text – 1234567890 – appears in the text.

If the output length is too short, fewer characters are displayed. Numeric fields are truncated on the left and prefixed with an asterisk (*). All other fields are truncated on the right, but no indication is given that the field is shorter.

DATA: NUMBER TYPE I VALUE 1234567890,
TEXT (10) VALUE ‘abcdefghij’.

WRITE: (5) NUMBER, /(5) TEXT.

This produces the following output:
7890
abcde

In the default setting, you cannot create empty lines with the WRITE statement.
WRITE: ‘One’,
/‘ ’,
/ ‘Two’

The output looks as follows:
One
Two

The system suppresses lines that contain nothing but empty spaces.

You can use various formatting options with the WRITE statement.

Syntax

WRITE…………

No comments:

Post a Comment