+ All Categories
Home > Documents > Chapter 03_Simple Output Statements

Chapter 03_Simple Output Statements

Date post: 20-Nov-2015
Category:
Upload: bakkalibilal
View: 14 times
Download: 0 times
Share this document with a friend
Description:
Chapter 03_Simple Output Statements
16
IBM Global Business Services © IBM Corporation 2013 Simple Output Statements | Dec-2008 Simple Output Statements
Transcript
Simple Output StatementsList the ABAP write statement
Writing Icons and Symbols
‘The current time is:’, SY-UZEIT.
SKIP 2.
********************
Notice that there is an automatic space between the fields written to the list.
Simple Output Statements |
The “WRITE” statement outputs the contents of a field or constant in a format consistent with the data type.
Successive WRITE statements output data on the same output line. When the line is full, output continues on the next line.
The “SKIP <n>“ statement creates <n> blank lines.
Normally, ABAP produces two standard header lines for each page. The date and page number are displayed on the first header line along with the program title. The second header line is an underline.
Many system fields are available in an ABAP program. These system fields are defined as the ABAP Dictionary structure SYST. To reference system fields in a program, use SY-<field name>. For example, SY-DATUM indicates the current date and SY-UZEIT indicates the current time.
You can use many methods to view the system ABAP Dictionary structure:
ABAP Dictionary
ABAP Help in a program (use help pushbutton or “F1”)
IBM Global Business Services
SKIP 2.
ULINE /10(60).
SKIP 2.
***** City of Philadelphia *****
Ticket Date 01/01/1997
Ticket Time 18:01:00
ABAP provides many methods for formatting data.
You can specify when to start a new line of output, start columns, and/or output length with the following statement:
WRITE /<pos(len)>. . . .
The forward slash (“/”) in the “WRITE” statement indicates to start the output on a new line.
The “ULINE” statement creates an underline.
You can specify the exact location for an underline by referencing a line feed, position, and/or length with the following statement:
ULINE /<pos(len)>.
SKIP 2.
ULINE /10(60).
SKIP 2.
***** City of Philadelphia *****
Ticket Date 01/01/1997
Ticket Time 18:01:00
Simple Output Statements |
The “UNDER” addition to the “WRITE” statement allows you to specify a field be printed in the same start column (left justified) directly beneath a field which has already been output.
You must still code an explicit line feed (with a forward slash) to move to the next line. The “UNDER” addition does not act as a line feed.
IBM Global Business Services
Simple Output Statements |
The sequence for the format specification of the “WRITE” statement must be followed precisely if more than one specification is used.
Formatting options include:
USING EDIT MASK (specifies a format template).
USING NO EDIT MASK (switched off any format template specified in the ABAP Dictionary).
NO-ZERO (replaces leading zeros with blanks; if the contents of a field are equal to zero, the output consist entirely of blanks).
There are many other formatting options. Consult the Extended Help text.
IBM Global Business Services
SKIP.
NEW-PAGE.
This statement will not create an empty page.
There are many interesting extensions to NEW-PAGE, such as PRINT ON. Look in Online Help for more information.
IBM Global Business Services
SYM_LEFT_HAND AS SYMBOL.
Execute programs “SHOWICON” and “SHOWSYMB” to display the system’s icons and symbols.
Simple Output Statements |
Certain symbols and icons can be written on a report. You must load the include programs <ICON> and/or <SYMBOL> (the angle brackets are part of the name) with the “INCLUDE <include program>” statement. You can also directly use TYPE-POOLS: icon for icon and TYPE-POOLS: sym for symbols.
To write an icon to the report, use the following syntax:
WRITE <icon name> AS ICON.
To write a symbol to the report, use the following syntax:
WRITE <symbol name> AS SYMBOL.
To display the complete list of icons, execute the program “SHOWICON”. For symbols, execute the program “SHOWSYMB”. You can go to the initial screen of the ABAP Editor (transaction code “SE38”) to execute these programs.
The INCLUDE statement can also be used to include separate data declarations that are used by many programs. For example: commonly used function export/import parameters, constants for TRUE/FALSE YES/NO flags, BDC_TAB, etc.
IBM Global Business Services
Simple Output Statements |
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.
Simple Output Statements |
Text elements can be used to maintain a program’s title and column headings, selection texts, and text symbols. These text elements can be maintained in multiple languages, so the display to the user will depend on the user’s specified logon language.
We will cover text symbols on the next page. Selection texts will be covered in the next chapter when we learn the “PARAMETERS” statement.
Maintain a list heading and up to four lines of column headings for a report by using the “GoTo Text elements Titles/headings” menu path).
The text placed in the “List header” field will replace the default title (short text of the program) on the program’s standard heading output.
IBM Global Business Services
Simple Output Statements |
Simple Output Statements |
Simple Output Statements |
Numbered texts (text symbols) are used most often for writing text to the screen that is language dependent.
Maintain numbered texts using the “GoTo Text elements Text Symbols” menu path).
It is possible to maintain numbered texts separately for different languages. Consult the SAP’s online help for information on maintaining text elements in multiple languages
The two methods of using numbered texts (text symbols) are:
TEXT-xxx [where “xxx” is a unique three-character code]
“<text string>”(xxx) [where “xxx” is a unique three-character code]
The TEXT-xxx method allows you to assign text to a text symbol for easier maintainability and coding. Therefore, you can refer to a long sentence as TEXT-xxx instead of writing in code the sentence every time it needs to be written to a list. The text contained in the text symbol will be written out in the user’s current logon language as long as it is maintained in that language. Otherwise nothing will be written out.
The <text string>(xxx) method also allows for easier language maintenance. In case the text symbol (xxx) is not maintained in the user’s logon language then the <text string> is used. However, this method loses the benefit of not having to code the same sentence many times.
IBM Global Business Services
Demonstration
Creation of text symbols and using that in the write statement.
Simple Output Statements |
Practice
Creation of text symbols and using that in the write statement.
Simple Output Statements |
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.
Simple Output Statements |
What are the various options associated with the ‘WRITE’ statement ?
What does the ‘NEW-PAGE’ statement do ?
Simple Output Statements |

Recommended