⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ch16.htm

📁 这个是sap开发语言abap的教育文档
💻 HTM
📖 第 1 页 / 共 3 页
字号:
<LI>Use <TT>destination</TT> to specify a printer ID.
<LI>Use <TT>copies</TT> to specify the number of copies to print.
<LI>Use <TT>layout</TT> to specify a printer layout. The printer
layout determines printer characteristics such as the number of
lines per page and the number of columns per line. You can see
the printer layouts defined for your installation by printing
something and looking at the Format field on the Print List Output
screen.
<LI>Use <TT>list name</TT> to specify a name for the list while
in the spool. You can use this to search for it later in the spool.
(Enter this value in the 3rd field beside Spool Request Name on
the Spool: Request Screen)
<LI>Use <TT>sap cover page</TT> to control the printing of a cover
page with the output. A blank value suppresses the cover page,
<TT>'X'</TT> causes one to print, and <TT>'D'</TT> indicates that
the printer settings should determine whether a cover page is
printed or not.
<LI>Use <TT>cover text</TT> to specify the title to be printed
on the cover page.
<LI>Use <TT>department</TT> to specify a department ID to be printed
on the cover page.
<LI>Use <TT>receiver</TT> to specify the name of the person who
should receive the report. It is printed on the cover page.
<LI>Use <TT>keep in spool 'X'</TT> to cause the spool request
to stay in the spool after the report has been printed. This allows
the user to reprint the list without re-running the report.
<LI>Use <TT>dataset expiration</TT> to specify how many days the
spool request should stay on the spool. When the request expires,
it is deleted from the spool.
<LI>Use <TT>line-count</TT> and <TT>line-size</TT> to specify
the number of lines per page and number of columns per line.
</UL>
<P>
Additional parameters are documented in the ABAP/4 keyword documentation.
<P>
<CENTER>
<TABLE BORDER=1>
<TR VALIGN=TOP><TD WIDTH=600><B>NOTE</B></TD></TR>
<TR VALIGN=TOP><TD WIDTH=600>
<BLOCKQUOTE>
When you send output directly to the spool using new-page print on, you can also use two additional statements. The set <TT>margins</TT> statement allows you to control the margins during printing. The print-control statement allows you to send printer control codes directly to the printer. By using print-control, you can control any printer characteristic, such as CPI (character per inch), LPI (lines per inch), or font. These statements have no effect on lists printed via the Print button or via the List Print menu option; they only affect lists printed via new-page print on. They do not affect the way the list is displayed on screen. See the ABAP/4 keyword documentation for more details.
</BLOCKQUOTE>

</TD></TR>
</TABLE>
</CENTER>
<P>
<P>
Listing 16.2 illustrates the use of the <TT>new-page print</TT>
statement.
<P>
<IMG SRC="../button/input.gif" tppabs="http://pbs.mcp.com/ebooks/0672312174/button/input.gif">
<HR>
<P>
<B>Listing 16.2&nbsp;&nbsp; The NEW-PAGE PRINT Statement<BR>
</B>
<BLOCKQUOTE>
<PRE>
1  report ztx1602.
2  tables ztxlfa1.
3  parameters: prt_id like estwo-spooldest obligatory.
4 
5  new-page print on
6      no dialog
7      immediately 'X'
8      destination prt_id.
9 
10 select * from ztxlfa1.
11     write: / ztxlfa1-lifnr.
12     endselect.
13
14 new-page print off.
15 write: / sy-dbcnt, 'lines sent to printer', prt_id.
</PRE>
</BLOCKQUOTE>
<HR>
<P>
<IMG SRC="../button/output.gif" tppabs="http://pbs.mcp.com/ebooks/0672312174/button/output.gif">
<P>
The code in Listing 16.2 produces the following output:
<BLOCKQUOTE>
<PRE>
        23  lines sent to printer BOS4           
</PRE>
</BLOCKQUOTE>
<P>
<IMG SRC="../button/analysis.gif" tppabs="http://pbs.mcp.com/ebooks/0672312174/button/analysis.gif">
<UL>
<LI>Line 3 prompts the user for a printer ID. The field <TT>estwo-spooldest</TT>
has a foreign key relationship to the table that contains the
printer IDs, so a down-arrow is displayed on the input field.
It allows the user to display a list of the available printer
IDs.
<LI>Line 5 redirects the output for subsequent <TT>write</TT>
statements. <TT>no dialog</TT> suppresses the display of the Print
Parameters screen. Instead the parameters are taken from the user
profile, and from the parameters specified on lines 6 through
8. <TT>immediately 'X'</TT> causes the output to be printed immediately.
Line 8 passes the printer ID entered by the user on the selection
screen.
<LI>The output from lines 10 through 12 is sent directly to the
printer. It is not seen in the output list.
<LI>Line 14 removes the indirection and the output from subsequent
<TT>write</TT> statements appear in the list.
</UL>
<H4>Displaying the ABAP/4 Keyword Documentation for new-page Ppint
</H4>
<P>
Normally, F1 help will not display the <TT>new-page print</TT>
documentation. To display it, use the following procedure:
<OL>
<LI>Begin at the ABAP/4 Editor: Initial Screen.
<LI>Choose the menu path Utilities-&gt; ABAP/4 Key Word Doc. You
then see the Display Structure: ABAP/4-SAP's 4GL Programming Language
screen.
<LI>Click the Find button on the standard toolbar. The Search
Titles screen is displayed.
<LI>In the Find field, type <TT>new-page print</TT>.
<LI>Click the Continue button. You are returned to the previous
screen and your cursor is positioned on the <TT>new-page print</TT>
line.
<LI>Double-click that line. The documentation for <TT>new-page
print</TT> is displayed.
</OL>
<H3><A NAME="UsingtheskipStatement">
Using the skip Statement</A></H3>
<P>
The <TT>skip</TT> statement allows you to
<UL>
<LI>Generate blank lines.
<LI>Move the current output position up or down within the current
output page.
</UL>
<H4>Syntax for the skip Statement</H4>
<BLOCKQUOTE>
<PRE>
skip [n | to line n].
</PRE>
</BLOCKQUOTE>
<P>
where:
<UL>
<LI><TT><I>n</I></TT> is a numeric
literal or variable.
</UL>
<P>
Without any additions, <TT>skip</TT> generates a blank line. <TT>Skip
<I>n</I></TT> generates <TT><I>n</I></TT>
blank lines. If <TT><I>n</I></TT>
is less than 1, no blank lines are generated. <TT>skip</TT> at
the end of the current page will cause a page break. <TT>skip</TT>
will generate blank lines after any <TT>write</TT> statement,
at the top of the first page, and at the top of any page begun
by the <TT>new-page</TT> statement. It will not generate blank
lines at the beginning of any other new page or at the end of
the last page of the list. For example, if there is space for
two more lines at the bottom of the current page, <TT>skip 5</TT>
will generate two blank lines at the bottom of the current page,
but none at the top of the next page. This happens because the
new page was not the first page and was not generated by a <TT>new-page</TT>
statement.<P>
<CENTER>
<TABLE BORDER=1>
<TR VALIGN=TOP><TD WIDTH=600><B>TIP</B></TD></TR>
<TR VALIGN=TOP><TD WIDTH=600>
<BLOCKQUOTE>
If you want a footer on the last page of your report, code skip <TT>sy-linct</TT> as the last statement in your program. This statement will write footers. If you want to trigger a new page and you want a footer at the bottom the cur-rent page, code skip <TT>sy-linct</TT> instead of new-page.
</BLOCKQUOTE>

</TD></TR>
</TABLE>
</CENTER>
<P>
<P>
<TT>skip to line <I>n</I></TT>
causes the current output position to be set to the beginning
of line <TT><I>n</I></TT> of the
current page. The output from the next <TT>write</TT> statement
will begin at that position. For example, <TT>skip to line 3</TT>
causes the output from the next <TT>write</TT> statement to begin
in column 1 of line 3. A <TT>skip to line</TT> statement that
contains a line number greater than the current number of lines
per page is ignored.
<P>
Listing 16.3 illustrates the use of the <TT>skip</TT> statement.
<P>
<IMG SRC="../button/input.gif" tppabs="http://pbs.mcp.com/ebooks/0672312174/button/input.gif">
<HR>
<P>
<B>Listing 16.3&nbsp;&nbsp;The SKIP Statement<BR>
</B>
<BLOCKQUOTE>
<PRE>
1  report ztx1603.
2  tables ztxlfa1.
3  data n type i.
4  select * from ztxlfa1 order by land1.
5      on change of ztxlfa1-land1.
6          if sy-dbcnt &gt; 1.
7              n = sy-linno - 1.
8              skip to line n.
9              write 35 '*** Last Vendor With This Country Code ***'.
10             endif.
11         write / ztxlfa1-land1.
12         endon.
13     write: /4 ztxlfa1-lifnr, ztxlfa1-name1.
14     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 16.3 produces the following output:
<BLOCKQUOTE>
<PRE>
CA
   1000       Parts Unlimited                                                        
   1010       Industrial Pumps Inc.                                                  
   1020       Chemical Nation Ltd.                                                   
   1030       ChickenFeed Ltd.     
   1050       The Bit Bucket                                                         
   1060       Memory Lane Ltd.                                                       
   1070       Flip My Switch Inc. *** Last Vendor With This Country Code ***
CC V9         Code Now, Specs Later Ltd.                                                    
   V10        Duncan's Mouse Inc. *** Last Vendor With This Country Code ***
DE V6         Anna Banana Ltd.
   V11        Wiener Schnitzel Inc.
   V12        Sauerkraut AG      *** Last Vendor With This Country Code ***
US V8         Smile When You Say That Ltd.
   1040       Motherboards Inc.
   1080       Silicon Sandwich Ltd.
   1090       Consume Ltd.
   2000       Monitors and More Ltd.
   V1         Quality First Ltd.
   V2         OverPriced Goods Inc.
   V3         Fluffy Bunnies Ltd.
   V4         Moo like a Cow Inc.
   V5         Wolfman Sport Accessories Inc.
   V7         The Breakfast Club Inc.
</PRE>
</BLOCKQUOTE>
<P>
Each time the value of <TT>ztxlfa1-land1</TT> changes
<P>
<IMG SRC="../button/analysis.gif" tppabs="http://pbs.mcp.com/ebooks/0672312174/button/analysis.gif">
<UL>
<LI>Line 5 is triggered each time the value of <TT>land1</TT>
changes.
<LI>On line 6, <TT>sy-dbcnt</TT> is the current loop pass counter.
When the first record is being processed it has a value of one,
and so the code inside the <TT>if</TT> is not executed for the
first record, but it is for every succeeding record.
<LI>For succeeding records, on line 7 <TT>sy-linno</TT> contains
the line number of the current list line. That is, it is the line
number that the next <TT>write</TT> statement will write to. One
is subtracted from it and this is assigned to <TT>n</TT>.
<LI>Line 8 moves the output position to the beginning of line
<TT>n</TT>, which is the previously written line.
<LI>Line 9 writes on that line, flagging the last vendor of each
group.
</UL>
<H3><A NAME="UsingthebackStatement">
Using the back Statement</A></H3>
<P>
Use the <TT>back</TT> statement to return the current output position
to
<UL>
<LI>The first line of the current page (the first line after <TT>top-of-page</TT>
has been processed).
<LI>The first line output after a reserve statement has been issued.
</UL>
<H4>Syntax for the back Statement</H4>
<P>
The following is the syntax for the <TT><B>back</B></TT>
statement:
<BLOCKQUOTE>
<PRE>
back.
</PRE>
</BLOCKQUOTE>
<P>
where:
<UL>
<LI><TT>back</TT> issued from within the <TT>top-of-page</TT>
event returns to the first line written within <TT>top-of-page</TT>.
</UL>
<P>
Explaining further, if you specified <TT>no standard page heading</TT>
on the <TT>report</TT> statement, it returns to the first line
of the page. If you have a standard page heading, the output position
is set to line first line following the standard header.
<P>
A sample program is shown in Listing 16.4.
<P>
<IMG SRC="../button/input.gif" tppabs="http://pbs.mcp.com/ebooks/0672312174/button/input.gif">
<HR>
<P>
<B>Listing 16.4&nbsp;&nbsp;The <I>BACK</I> Statement<BR>
</B>
<BLOCKQUOTE>
<PRE>
1  report ztx1604 no standard page heading.
2  data n type i.
3  do 4 times.
4      write: /(4) sy-index.
5      enddo.
6  back.
7  do 4 times.
8      n = sy-index * 10.
9      write: /10(4) n.
10     enddo.
11
12 top-of-page.
13     write: / 'This was my title'.
14     uline.
15     back.
16     write 6 'is '.
17     skip.
</PRE>
</BLOCKQUOTE>
<HR>
<P>
<IMG SRC="../button/output.gif" tppabs="http://pbs.mcp.com/ebooks/0672312174/button/output.gif">
<P>
The code in Listing 16.4 produces the following output:
<BLOCKQUOTE>
<PRE>
This is  my title   
-----------------------
  1       10        
  2       20        

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -