IBM Global Services
Simple Output Statements
Simple Output Statements | 3.03 March-2005 © 2005 IBM Corporation
IBM Global Services
Objectives
The participants will be able to :
List the ABAP write statement
Writing Icons and Symbols
List New-Page statement
Maintaining page header
2 Simple Output Statements | 3.03 March-2005 © 2005 IBM Corporation
IBM Global Services
The ABAP “WRITE” Statement
WRITE ‘********************’.
SKIP 2.
WRITE: ‘The date today is:’, SY-DATUM,
‘The current time is:’, SY-UZEIT.
SKIP 2. Notice that there is an automatic space
WRITE ‘********************’. between the fields written to the list.
<program title> 1
-----------------------------------------------------------------------------------
********************
The date today is: 12/30/1996 The current time is: 12:32:06
********************
3 Simple Output Statements | 3.03 March-2005 © 2005 IBM Corporation
IBM Global Services
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 *****
4 Simple Output Statements | 3.03 March-2005 © 2005 IBM Corporation
IBM Global Services
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 *****
5 Simple Output Statements | 3.03 March-2005 © 2005 IBM Corporation
IBM Global Services
“WRITE” Statement Extended Syntax
WRITE <format> <value> <options> .
<format>
/p(I)
/ = Line Feed <value>
p = Column Position
I = Output Length
Program Field or <options>
Text Literal
Format Options
6 Simple Output Statements | 3.03 March-2005 © 2005 IBM Corporation
IBM Global Services
“NEW-PAGE” Statement
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:
7 Simple Output Statements | 3.03 March-2005 © 2005 IBM Corporation
IBM Global Services
Writing Icons and Symbols
INCLUDE <ICON>.
INCLUDE <SYMBOL>.
Or
TYPE-POOLS: icon.
TYPE-POOLS: sym.
WRITE: /10 ICON_DATE AS ICON, SY-DATUM,
SYM_LEFT_HAND AS SYMBOL.
Execute programs
“SHOWICON” and
“SHOWSYMB” to display
the system’s icons and
symbols.
8 Simple Output Statements | 3.03 March-2005 © 2005 IBM Corporation
IBM Global Services
Maintaining Page Headers
List header will replace title
on first line of standard
header.
Up to four lines of column
headings can be maintained
for the list. The title comes from the
program’s attributes.
9 Simple Output Statements | 3.03 March-2005 © 2005 IBM Corporation
IBM Global Services
Demonstration
Exploring ABAP ‘Write’ statement with various options.
10 Simple Output Statements | 3.03 March-2005 © 2005 IBM Corporation
IBM Global Services
Practice
Exploring ABAP ‘Write’ statement with various options.
11 Simple Output Statements | 3.03 March-2005 © 2005 IBM Corporation
IBM Global Services
Numbered Texts (Text Symbols)
WRITE: / TEXT-001, ‘BIG BLUE’,
/ TEXT-002, ‘TEST IT’.
Text symbols are referenced
by a unique three-character
code.
12 Simple Output Statements | 3.03 March-2005 © 2005 IBM Corporation
IBM Global Services
Demonstration
Creation of text symbols and using that in the write statement.
13 Simple Output Statements | 3.03 March-2005 © 2005 IBM Corporation
IBM Global Services
Practice
Creation of text symbols and using that in the write statement.
14 Simple Output Statements | 3.03 March-2005 © 2005 IBM Corporation
IBM Global Services
Summary
The “WRITE” statement outputs the contents of a field or constant in a format
consistent with the data type.
The “SKIP“ statement creates blank lines.
The “NEW-PAGE” statement starts a new page.
For writing ‘Icon’ and ‘Symbols’ in the report, TYPE-POOL ICON & SYM need to
be included in the program respectively.
Text elements can be maintained in multiple languages, so the display to the user
will depend on the user’s specified logon language.
15 Simple Output Statements | 3.03 March-2005 © 2005 IBM Corporation
IBM Global Services
Questions
What are the various options associated with the ‘WRITE’ statement ?
What does the ‘NEW-PAGE’ statement do ?
16 Simple Output Statements | 3.03 March-2005 © 2005 IBM Corporation