BC170_2.03.1
Simple Output Statements
BC170_2.03.2
Objectives
• The participants will be able to:
– Create basic output lists using the WRITE
statement
– Add formatting to an ABAP report
– Use the NEW-PAGE command
– Add Icons to an ABAP report
– Maintain Page Headers
– Use Text Symbols in ABAP Code
BC170_2.03.3
The ABAP WRITE Statement
WRITE
‘********************’.
SKIP 2
.
WRITE
:
‘The date today is:’, SY-
DATUM,
‘The current time is:’, SY-
UZEIT.
SKIP
.
WRITE
‘********************’.
<program title>
1
--------------------------------------------------------------------
------------
********************
The date today is: 12/30/1996 The current time
is: 12:32:06
********************
Notice that there is an
automatic space
between the fields
written to the list.
BC170_2.03.4
ABAP Format Specifications
WRITE 10 ‘***** City of Philadelphia *****’.
SKIP 2.
WRITE:
10
‘Ticket Date’, SY-DATUM.
WRITE:
/10
‘Ticket Time’, SY-UZEIT.
ULINE /10(60)
.
SKIP 2.
WRITE 10 ‘***** Department of Public Safety
*****’.
***** City of Philadelphia *****
Ticket Date 01/01/1997
Ticket Time 18:01:00
---------------------------------------------------
--
***** Department of Public Safety
*****
BC170_2.03.5
ABAP Format Options
WRITE 10 ‘***** City of Philadelphia *****’.
SKIP 2.
WRITE: 10 ‘Ticket Date’, 25 SY-DATUM,
/10 ‘Ticket Time’, SY-UZEIT
UNDER
SY-
DATUM.
ULINE /10(60).
SKIP 2.
WRITE 10 ‘***** Department of Public Safety
*****’.
***** City of Philadelphia *****
Ticket Date 01/01/1997
Ticket Time 18:01:00
-------------------------------------------------------
-----
***** Department of Public Safety *****
BC170_2.03.6
WRITE Statement Extended
Syntax
WRITE
<format>
<value>
<options>
.
/p(I)
/ = Line Feed
p = Column Position
I = Output Length
<format>
Program Field or
Text Literal
<value>
Format Options
<options>
BC170_2.03.7
WRITE ‘***** City of Philadelphia *****’.
SKIP.
WRITE: / ‘Ticket Date’, 15 SY-DATUM.
WRITE: / ‘Ticket Time’, 15 SY-UZEIT.
SKIP.
WRITE ‘***** Department of Public Safety
*****’.
NEW-PAGE.
WRITE: ‘Comments:’.
<program title> 1
--------------------------------------------------------------------------------------
***** City of Philadelphia *****
Ticket Date 01/01/1997
Ticket Time 18:01:00
***** Department of Public Safety *****
<program title> 2
---------------------------------------------------------------------------------------
Comments:
NEW-PAGE Statement
BC170_2.03.8
Writing Icons and Symbols
INCLUDE <ICON>.
INCLUDE <SYMBOL>.
WRITE: /10 ICON_DATE
AS ICON
, SY-DATUM,
SYM_LEFT_HAND
AS SYMBOL
.
BC170_2.03.9
Maintaining Page Headers
The title comes
from the
program’s
attributes.
List header will
replace title on first
line of standard
header.
Up to four lines of
column headings can
be maintained for the
list.
BC170_2.03.10
Numbered Texts (Text Symbols)
Text symbols are
referenced by a unique
three-character code.
WRITE: /
TEXT-001
, BIRTHDAY,
/
TEXT-002
, SY-DATUM.
BC170_2.03.11
Text Element Output
TEXT-
001
TEXT-
002
WRITE: /
TEXT-001
, BIRTHDAY,
/
TEXT-002
, SY-DATUM.
BC170_2.03.12
Summary
• The participants should be able to:
– Create basic output lists using the WRITE
statement
– Add formatting to an ABAP report
– Use the NEW-PAGE command
– Add Icons to an ABAP report
– Maintain Page Headers
– Use Text Symbols in ABAP Code