📄 ch15.htm
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!--
function popUp(pPage) {
popUpWin = window.open('','popWin','resizable=yes,scrollbars=no,width=525,height=394');
figDoc= popUpWin.document;
zhtm= '<HTML><HEAD><TITLE>' + pPage + '</TITLE>';
zhtm += '</head>';
zhtm += '<BODY bgcolor="#FFFFFF">';
zhtm += '<IMG SRC="' + pPage + '">';
zhtm += '<P><B>' + pPage + '</B>';
zhtm += '</BODY></HTML>';
figDoc.write(zhtm);
figDoc.close();
popUpWin.focus();
}
//-->
</SCRIPT>
<META NAME="GENERATOR" Content="Symantec Visual Page 1.0.1">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html;CHARSET=iso-8859-1">
<TITLE>Sams Teach Yourself ABAP/4® in 21 Days -- Day 15- Formatting Techniques, Part 1</TITLE>
</HEAD>
<BODY TEXT="#000000" BGCOLOR="#FFFFFF">
<CENTER>
<H1><IMG SRC="../button/sams.gif" tppabs="http://pbs.mcp.com/ebooks/0672312174/button/sams.gif" BORDER="0"></H1>
</CENTER>
<CENTER>
<P><A HREF="gla03.htm" tppabs="http://pbs.mcp.com/ebooks/0672312174/ch15/gla03.htm"><IMG SRC="../button/previous.gif" tppabs="http://pbs.mcp.com/ebooks/0672312174/button/previous.gif" BORDER="0"></A>
<A HREF="../index.htm" tppabs="http://pbs.mcp.com/ebooks/0672312174/index.htm"><IMG SRC="../button/contents.gif" tppabs="http://pbs.mcp.com/ebooks/0672312174/button/contents.gif" BORDER="0"></A>
<A HREF="../ch16/ch16.htm" tppabs="http://pbs.mcp.com/ebooks/0672312174/ch16/ch16.htm"><IMG SRC="../button/next.gif" tppabs="http://pbs.mcp.com/ebooks/0672312174/button/next.gif" BORDER="0"></A>
<H1>Sams Teach Yourself ABAP/4<sup>®</sup> in 21 Days</H1></CENTER>
<HR SIZE=4>
<H1>Day 15</H1>
<H1>Formatting Techniques, Part 1</H1>
<UL>
<LI><A HREF="#ChapterObjectives">
Chapter Objectives</A>
<LI><A HREF="#GraphicalFormattingwiththewriteStatement">
Graphical Formatting with the write Statement</A>
<UL>
<LI><A HREF="#SyntaxfortheGraphicalAdditionstothewriteStatement">
Syntax for the Graphical Additions to the write Statement
</A>
<LI><A HREF="#UsingtheassymbolAddition">
Using the as symbol Addition</A>
<LI><A HREF="#UsingtheasiconAddition">
Using the as icon Addition</A>
<LI><A HREF="#UsingtheaslineAddition">
Using the as line Addition</A>
<LI><A HREF="#DisplayingtheAvailableSymbolsIconsandlinedrawCharacters">
Displaying the Available Symbols, Icons, and line-draw Characters
</A>
</UL>
<LI><A HREF="#ReportFormattingandPrinting">
Report Formatting and Printing</A>
<UL>
<LI><A HREF="#ControllingPageSize">
Controlling Page Size</A>
<LI><A HREF="#CreatingPageHeadersandFooters">
Creating Page Headers and Footers</A>
</UL>
<LI><A HREF="#Summary">
Summary</A>
<LI><A HREF="#QampABR">
Q&A<BR>
</A>
<LI><A HREF="#Workshop">
Workshop</A>
<UL>
<LI><A HREF="#Quiz">
Quiz</A>
<LI><A HREF="#Exercise">
Exercise 1</A>
</UL></UL>
<HR>
<H2><A NAME="ChapterObjectives"><FONT SIZE=5 COLOR=#FF0000>
Chapter Objectives</FONT></A></H2>
<P>
After you have completed this chapter, you will be able to
<UL>
<LI>Use the graphical formatting options of the <TT>write</TT>
statement (as symbols, icons, and lines).
<LI>Print list output and manipulate the output on the spool.
<LI>Create headers and footers (<TT>no standard page heading</TT>,
<TT>top-of-page</TT>, <TT>end-of-page</TT>).
<LI>Use the <TT>reserve</TT> statement to keep groups of lines
together in the output list.
</UL>
<H2><A NAME="GraphicalFormattingwiththewriteStatement"><FONT SIZE=5 COLOR=#FF0000>
Graphical Formatting with the write Statement</FONT></A></H2>
<P>
To write simple graphics you can use the three additions shown
in Table 15.1.<BR>
<P>
<CENTER><B>Table 15.1 Graphical Formatting Additions
for the write Statement</B></CENTER><CENTER>
<TABLE BORDER=1>
<TR VALIGN=TOP><TD WIDTH=192><CENTER><B>Addition</B></CENTER></TD><TD WIDTH=192><CENTER><B>Effect</B></CENTER>
</TD></TR>
<TR VALIGN=TOP><TD WIDTH=192><TT>as symbol</TT></TD><TD WIDTH=192>Displays a black-and-white symbol
</TD></TR>
<TR VALIGN=TOP><TD WIDTH=192><TT>as icon</TT></TD><TD WIDTH=192>Displays a color icon
</TD></TR>
<TR VALIGN=TOP><TD WIDTH=192><TT>as line</TT></TD><TD WIDTH=192>Displays a line-draw character
</TD></TR>
</TABLE>
</CENTER>
<P>
<H3><A NAME="SyntaxfortheGraphicalAdditionstothewriteStatement">
Syntax for the Graphical Additions to the write Statement
</A></H3>
<BLOCKQUOTE>
<PRE>
write <I>n1</I> (a) as symbol.
(b) as icon.
(c) as line.
</PRE>
</BLOCKQUOTE>
<P>
where:
<UL>
<LI>Additions <TT>(a)</TT>, <TT>(b)</TT>, and <TT>(c)</TT> are
mutually exclusive.
<LI><TT><I>n1</I></TT> is the
name of a symbol, icon, or <TT>line-draw</TT> character.
</UL>
<H3><A NAME="UsingtheassymbolAddition">
Using the as symbol Addition</A></H3>
<P>
<IMG SRC="../button/newterm.gif" tppabs="http://pbs.mcp.com/ebooks/0672312174/button/newterm.gif">
<P>
A<I> symbol</I> is a simple two-color picture of a common symbol
such as a square, circle, folder, or document. Most symbols take
the place of a single character in the output list, although some
can take two spaces, for example, the symbol of a fist pointing
left (<TT>sym_left_hand</TT>). A sample statement would be <TT>write
sym_left_hand as symbol</TT>.
<P>
In order to write a symbol, you must include one of the two following
statements at the top of your program:
<BLOCKQUOTE>
<PRE>
include <symbol>.
</PRE>
</BLOCKQUOTE>
<P>
or
<BLOCKQUOTE>
<PRE>
include <list>.
</PRE>
</BLOCKQUOTE>
<P>
All symbols are printable. This means that if you send your output
to the printer, they will appear on paper exactly as you see them
online.
<P>
<IMG SRC="../button/newterm.gif" tppabs="http://pbs.mcp.com/ebooks/0672312174/button/newterm.gif">
<P>
The name between angle brackets is an <I>include program</I>.
It contains a set of statements that define the names of the symbols
you can use. The <TT><symbol></TT> include contains only
the symbol definitions. The <TT><list></TT> include contains
symbols, icons, line-draw characters, and color definitions. Listing
15.1 contains a sample program using symbols.
<P>
<IMG SRC="../button/input.gif" tppabs="http://pbs.mcp.com/ebooks/0672312174/button/input.gif">
<HR>
<P>
<B>Listing 15.1 Display Symbols<BR>
</B>
<BLOCKQUOTE>
<PRE>
1 report ztx1501.
2 include <symbol>.
3 tables ztxlfa1.
4 write: / sym_plus_box as symbol, 'Vendor Master Tables',
5 /4 sym_filled_circle as symbol, 'LFA1',
6 /4 sym_filled_circle as symbol, 'LFB1',
7 /4 sym_filled_circle as symbol, 'LFC1',
8 / sym_plus_box as symbol, 'Customer Master Tables',
9 /4 sym_filled_square as symbol, 'KNA1',
10 /4 sym_filled_square as symbol, 'KNB1',
11 /4 sym_filled_square as symbol, 'KNC1'.
12 skip.
13 uline.
14 select * up to 5 rows from ztxlfa1.
15 write: / ztxlfa1-lifnr,
16 ztxlfa1-name1,
17 sym_phone as symbol,
18 ztxlfa1-telf1.
19 endselect.
</PRE>
</BLOCKQUOTE>
<HR>
<P>
<IMG SRC="../button/output.gif" tppabs="http://pbs.mcp.com/ebooks/0672312174/button/output.gif">
<P>
The code in Listing 15.1 produces the output shown in Figure 15.1.
<P>
<A HREF="javascript:popUp('f15-1.gif')"><B>Figure 15.1 :</B> <I>This is a sample of list output containing
symbols</I>.</A>
<P>
<IMG SRC="../button/analysis.gif" tppabs="http://pbs.mcp.com/ebooks/0672312174/button/analysis.gif">
<UL>
<LI>Lines 4 through 11 write out a list of hard-coded table names
in bullet form.
<LI>Lines 14 through 19 write out vendor numbers, names, and telephone
numbers preceded by the telephone symbol.
</UL>
<H3><A NAME="UsingtheasiconAddition">
Using the as icon Addition</A></H3>
<P>
An <I>icon</I> is similar to a symbol, but is a multi-colored
picture that can appear in the output list. Most icons take two
spaces in the output list, although a few take more. An example
of a <TT>write</TT> statement that writes an icon would be <TT>write
icon_led_red as icon</TT>.
<P>
To write an icon, you must include one of the two following statements
at the top of your program:
<BLOCKQUOTE>
<PRE>
include <icon>.
</PRE>
</BLOCKQUOTE>
<P>
or
<BLOCKQUOTE>
<PRE>
include <list>.
</PRE>
</BLOCKQUOTE>
<P>
Not all icons are printable. The procedure to determine which
ones can be printed follows later in this chapter.
<P>
Listing 15.2 writes out a few sample icons.
<P>
<IMG SRC="../button/input.gif" tppabs="http://pbs.mcp.com/ebooks/0672312174/button/input.gif">
<HR>
<P>
<B>Listing 15.2 How to Write Icons to the List<BR>
</B>
<BLOCKQUOTE>
<PRE>
1 report ztx1502.
2 include <icon>.
3 tables: ztxmara, ztxmgef.
4 data ico like icon_generate.
5
6 write: / 'checkmark', 15 icon_checked as icon,
7 / 'red x', 15 icon_incomplete as icon,
8 / 'overview', 15 icon_overview as icon,
9 / 'time period', 15 icon_period as icon.
10 skip.
11 uline.
12 skip.
13 write: / 'List of Materials with Radioactive Indicators'.
14 uline.
15 select * from ztxmara.
16 clear ico.
17 if not ztxmara-stoff is initial.
18 select single * from ztxmgef where stoff = ztxmara-stoff.
19 if ztxmgef-lagkl = 7.
20 ico = icon_generate.
21 endif.
22 endif.
23 write: / ico as icon,
24 ztxmara-matnr,
25 ztxmara-mtart,
26 ztxmara-matkl,
27 ztxmara-brgew,
28 ztxmara-ntgew,
29 ztxmara-gewei.
30 endselect.
</PRE>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -