在abap报表的第二画面画一个带title的方框,这个功能在我们编写报表的时候会经常地用到。所以偶就拿出来,省得以后用到的时候找不到了,同时也能带给大家方便。
REPORT ZBOX NO STANDARD PAGE HEADING.
PERFORM BOX USING 1 2 'TITLE1'.
PERFORM BOX USING 5 4 'TITLE2'.
PERFORM BOX USING 11 7 'TITLE3'.
PERFORM BOX USING 20 7 'TITLE4'.
*---------------------------------------------------------------------*
* FORM BOX *
* Draw a box with title *
* YPOS: y coordinate of the upper left corner *
* HEIGHT: height of the box *
* TEXT: the title of te box *
*---------------------------------------------------------------------*
FORM BOX USING VALUE(YPOS) HEIGHT TEXT.
*
DATA: WIDTH TYPE I VALUE 84,
R TYPE I, K TYPE I.
* Bottom horizontal line
R = HEIGHT + YPOS.
SKIP TO LINE R.
DO WIDTH TIMES.
WRITE '-' NO-GAP.
ENDDO.
* Top horizontal line with text
K = STRLEN( TEXT ).
R = WIDTH - 2 - K.
SKIP TO LINE YPOS.
WRITE: '--'.
WRITE AT 3(K) TEXT NO-GAP.
DO R TIMES.
WRITE: '-' NO-GAP.
ENDDO.
* Vertical lines
DO HEIGHT TIMES.
SKIP TO LINE YPOS.
WRITE: '|'. POSITION WIDTH. WRITE: '|'.
YPOS = YPOS + 1.
ENDDO.
ENDFORM.