ABAP OUTPUT DATA IN LIST

来源:互联网 发布:新手如何装修淘宝店铺 编辑:程序博客网 时间:2024/06/08 19:20

第一个write语句触发了list generation,输出的内容被放入了list buffer中,当buffer完成时就会通过list buffer生成screen image。作为标准功能list中有两个header line,第一个header line在最左边是Programprogram attribute中维护的program title,最右边是页码。第二个header line是一条连续的横线。当打印list时,header的格式如下:左上角系统日期,中间program title,右上角page number。事务代码libs中有各种list格式的demo,不过其在netweaver中不存在。List的默认长度是83column,每页的默认行数是60000,可以通过report语句的LINE-SIZELINE-COUNT来覆盖默认设置,这些值只能通过数字来设置不能是变量。可以通过NEW-PAGE LINE-SIZE LINE-COUNT来覆盖default配置,list宽度的改变只能通过创建一个新的list buffer来实现,可以把LINE-SIZE,LINE-COUNT设置成零来恢复默认设置。每页的行数包括headingsdetailsfooter lines。在REPORT/PROGRAM语句中通过NO STANDARD PAGE HEADING可以屏蔽掉标准的header。可以通过NEW-PAGE NO-TITLE/WITH TITLE,或NEW-PAGE NO-HEADING/WITH HEADING来覆盖全局设置。TOP-OF-PAGE用来创建page header。这个事件在遇到第一个WRITEULINESKIP时就会在PRIMARY LIST BUFFER中触发。如果没有suppress标准的list buffer,它就会放在TOP OF PAGE产生的文本的上面。TOP OF PAGE中的行不受vertical scrolling 的影响。

FORMAT OPTIONS:

l         COLOR <n> [ON|OFF] Colors the line background

l         INTENSIFIED [ON|OFF] Intensify colors YES|NO

l         INVERSE [ON|OFF] Inverse: Background/text color

l         HOTSPOT [ON|OFF] Display mouse pointer as hand and single click (see AT LINE-SELECTION)

l         INPUT [ON|OFF] Input field

l         RESET Resets all formats to their default values

FORMAT后面的语句都会使用format设置的格式,直到FORMAT OFFFORMAT RESET。在新的事件中FORMAT OPTION都会被重设为默认值。可以通过语句WRITE WA_SPFLI COLOR COL_KEY.为单个字段设置FORMAT OPTION

WRITE语句;

NO-GAP Suppresses output of spaces after the <f> field.
Fields output directly after each other appear without gaps.

·   

NO-ZERO If the contents of field <f> are equal to zero, only spaces are
output. If the field is type C or N, spaces replace leading zeros.

·   

DD/MM/YY Overrides the date formatting rule defined at the User profile level.

·   

CURRENCY <key> Formats currency fields based on rules defined in table TCURX.

·   

UNIT <key> Formats quantity fields based on rules defined in table T0006.

·   

USING EDIT MASK <mask> Outputs according to the formatting template<mask>.

·   

UNDER <g> The output begins at the column in which field <g> was output.

·   

LEFT-JUSTIFIED Left-justified output (default for types C, N, D, T, X).

·   

CENTERED Centered output within the output length.

·   

RIGHT-JUSTIFIED Right-justified output (standard for all number fields: I, P and F)

可以通过write语句的AS SYMBOLlist中显示symbol,前提是需要INCLUDE <SYMBOL>,同样还有INCLUDE <ICON>。通过INCLUDE <LIST>相当于INCLUDE <SYMBOL> <LINES> <ICON> <COLOR>ULINEWRITE SY-ULINE可以实现下划线,WRITE SY-VLINE可以实现竖直线。右上角可以通过WRITE line_top_right_corner AS LINE来实现。通过这些元素可以用来创建tabletree。可以通过SET LEFT SCROLL-BOUNDARY COLUMN冻结左边的列,如果不给参数<number_of_columns>赋值冻结的列数就是WRITE语句所在的列(SY-COLNO)。必须在TO-OF-PAGE或者TOP-OF-PAGE DURING LINE-SELECTION中使用这个语句,因为在每页的结尾系统会自动把这个值设为0。可以通过NEW-LINE NO SCROLLING,来冻结下面的行,这样做的好处是避免SUB-HEADSscroll。通过scroll语句可以滚动到指定list buffer的指定页的指定行。SCROLL LIST TO PAGE <page_number> INDEX sy-lsind LINE <line_number>

其他的关于page layout的语句

·   

NEW-PAGE Creates a page break.

·   

NEW-LINE Creates a line break and is the equivalent of "/" in a WRITE statement.

·   

RESERVE <n> LINES If the current page does not have space for at least <n> more lines
in the list structure, a page feed is generated.

·   

SKIP <n> <n> blank lines are output.

·   

SKIP TO LINE <n> Positions the print cursor to line <n> on the current page.

·   

BACK Positions the print cursor to the first line after the headers on the current page.

·   

BACK (with RESERVE) When used with RESERVE, returns the print cursor to the line where the RESERVE keyword was issued.

·   

POSITION <n> Positions the print cursor to column <n> of the current line.

·   

SET BLANK LINES ON Blank lines created by SKIP and blank fields are output.

·   

SET BLANK LINES OFF No blank lines are output (default setting).

·   

RESERVE, POSITION, and BACK are useful for printing mailing labels.

Text element包括standard page headertext symbolsselection textsWrite text symbol的两种写法:

WRITE TEXT-xxx (xxx is a three-character string)

 

·   

literal text (xxx)

 

 

 

 

事务代码SLIN可用来检查维护的TEXT SYMBOL是否完整。

List的有关系统变量:

 

 

 

SY-LINCT Number of lines from REPORT statement (LINE-COUNT)

 

 

 

SY-LINSZ Line width from REPORT statement (LINE-SIZE)

 

 

 

SY-SROWS Number of lines in the display window

 

 

 

SY-SCOLS Number of columns in the display window

 

 

 

SY-PAGNO Page number of the current page

 

 

 

SY-LINNO Line number of the current line of the current page (SY-PAGNO)

 

 

 

SY-COLNO Column number of the current column

EXAMPLE

REPORT  ZTESTLIST NO STANDARD PAGE HEADING
                  
LINE-COUNT 50
                  
LINE-SIZE 1023.
INCLUDE <list>.

TABLES: mara.
FIELD-SYMBOLS <fs_col>.
TOP-
OF-PAGE.
  
SET LEFT SCROLL-BOUNDARY COLUMN 20.
  
WRITE'TEST'.
  
WRITE: SY-PAGNO.
START-
OF-SELECTION.
SELECT * FROM mara.
*  FORMAT INPUT ON.
  
IF sy-dbcnt = 10.
    
NEW-LINE NO-SCROLLING.
  
ELSE.
    
NEW-LINE.
  
ENDIF.
  
DO.
     
ASSIGN COMPONENT sy-index OF STRUCTURE mara
        
TO <fs_col>.
     
IF sy-index > 10.
       
EXIT.
     
ENDIF.
     
WRITE: <fs_col>.
  
ENDDO.
  
WRITE: line_top_right_corner AS LINE.
*  NEW-PAGE WITH-HEADING.
ENDSELECT.
END-OF-SELECTION.
SCROLL LIST TO PAGE 10.
SCROLL LIST TO COLUMN 5.

原创粉丝点击