0% found this document useful (0 votes)
241 views7 pages

Draw Box Sapscript

The document provides instructions on how to draw boxes and tables in SAPscript using the BOX, POSITION, and SIZE commands. It explains the syntax for each command and their parameters such as XPOS, YPOS, WIDTH, HEIGHT, FRAME, and INTENSITY. Examples are given to demonstrate how to draw boxes, lines, and tables. The BOX command is used to draw boxes and lines, while POSITION and SIZE set the coordinate system and box dimensions.

Uploaded by

badzkun
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
241 views7 pages

Draw Box Sapscript

The document provides instructions on how to draw boxes and tables in SAPscript using the BOX, POSITION, and SIZE commands. It explains the syntax for each command and their parameters such as XPOS, YPOS, WIDTH, HEIGHT, FRAME, and INTENSITY. Examples are given to demonstrate how to draw boxes, lines, and tables. The BOX command is used to draw boxes and lines, while POSITION and SIZE set the coordinate system and box dimensions.

Uploaded by

badzkun
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

Draw Box Sapscript

To Draw a BOX in a Sapscript


POSTED ON MAY 8, 2007
The Code is here for drawing the Box for Total in last page (where there is no next page)
/:
/:
/:
/:
/:

IF &NEXTPAGE& = 0
BOX FRAME 10 TW
BOX HEIGHT 0.8 CM FRAME 10 TW
BOX HEIGHT 1.9 CM FRAME 10 TW
BOX XPOS 2.5 CM YPOS 0.8 CM WIDTH 1.1 CM HEIGHT 1.9 CM FRAME 10 >

Now some help from help.sap.com to understand the code better


1. /: BOX [XPOS] [YPOS] [WIDTH] [HEIGHT] [FRAME] [INTENSITY]

Effect

Draws a box at this position with the specified size.

Additional
XPOS, YPOS, WIDTH, HEIGHT and FRAME always require

specifs.
a measurement and a unit of measurement to be specified. The additional specification
INTENSITY requires the specification of a percent number between 0 and 100.

XPOS, YPOS
Upper left corner of box, based on the values from the POSITION command.
Default: Values from POSITION commandThe following internal calculation rule is
used to determine the absolute output position of a box on the page:
X(abs) = XORIGIN + XPOS
Y(abs) = YORIGIN + YPOS
WIDTH
Width of box
Default: WIDTH value from SIZE command
HEIGHT
Height of box
Default: HEIGHT value from SIZE command
FRAME
Frame thickness
Default: 0 (no frame line)

INTENSITY
Density of the box contents in %
Default: 100 (solid black)

Measurements
Decimal measurements must be enclosed in inverted commas as literals (like ABAP
number constants). The period should be used as the decimal point. Also see the
following examples.

Unit
Valid units of measurement are TW (twip), PT (point), IN (inch), MM (millimeter), CM
(centimeter), LN (line), CH (character). The following conversions apply:
1 TW = 1/20 PT
1 PT = 1/72 IN
1 IN = 2.54 CM
1 CM = 10 MM
1 CH = character height from layout set header (CPI)
1 LN = line height from layout set header (LPI)

/: BOX FRAME 10 TW
Draws a frame around the current window with a frame thickness of 10 TW (= 0.5 PT)
/: BOX INTENSITY 10
Shades the window background with a density (gray shade) of
10 %
/: BOX HEIGHT 0 TW FRAME 10 TW
Draws a horizontal line at the upper window border over the entire window width
/: BOX WIDTH 0 TW FRAME 10 TW
Draws a vertical line at the left window border over the entire window height
/: BOX WIDTH '17.5' CM HEIGHT '1' CM FRAME 10 TW INTENSITY 15
WIDTH '17.5' CM HEIGHT '13.5' CM FRAME 10 TW
WIDTH 0 TW HEIGHT '13.5' CM FRAME 10 TW

/: BOX

/: BOX XPOS '10.0' CM

/: BOX XPOS '13.5' CM WIDTH 0

TW HEIGHT '13.5' CM FRAME 10 TW


Draws two rectangles and two lines to construct a three-column table with a highlighted
heading line
HC ,,,,,,,,,,&V_TOTALS_TXTD&
HE
/: IF &V_UOM1& <> .
HJ ,,&V_QUAN1&,,&V_UOM1&
/: ELSE
HJ
/: ENDIF

HJ ,,&V_TOW_TXTD&,,&V_SOP_TXTD&
This finally gives an output of the above Box shown in pic.

SAP Scripts Boxes/Lines/Shading


Setting default parameters for a box:
You can use the POSITION and SIZE commands to set default parmeters for a
box.
Instead of:
/: BOX XPOS '11.21' MM YPOS '5.31' MM HEIGHT '10' MM WIDTH '20' MM
INTENSITY 10 FRAME 0 TW
You can write:
/: POSITION XORIGIN '11.21' YORIGIN '5.31' MM
/: SIZE HEIGHT '2' MM WIDTH '76' MM
/: BOX FRAME 10 TW INTENSITY 10
This can be usefull if you gave several boxes that share the same parameters.
If you want to set the position realtively to the window use POSITION WINDOW
to set the position to the top/left start of the window. Then use POSITION
to set the current position relatively to the start of the Window.
Note that you uses "+" or "-" in the ORIGIN position to the set the position
relatively.
/: POSITION WINDOW
/: POSITION XORIGIN '+5' MM YORIGIN '+10' MM
the position is now 5 MM from the left and 10 MM from the top of the window
NOTE: After using the position command you can move the current position
realtively to the last used position
/: POSITION XORIGIN '+10' MM YORIGIN '+20' MM
Now the position will be X = 15 and Y = 30

Drawing a line. You can draw a line by setting the Height or Weidth to 0
and add a frane. E.g. a horizontal line:
/: SIZE HEIGHT '0' MM WIDTH '200' MM
/: BOX FRAME 10 TW XPOS '11.21' MM YPOS '14.81' MM INTENSITY 100

Hi,
Use BOx Syantax How to Draw table in SAPscript ??? Pls Read the description
Syntax:
1. /: BOX [XPOS] [YPOS] [WIDTH] [HEIGHT] [FRAME] [INTENSITY]
2. /: POSITION [XORIGIN] [YORIGIN] [WINDOW] [PAGE]
3. /: SIZE [WIDTH] [HEIGHT] [WINDOW] [PAGE]
BOX
Syntax:
/: BOX [XPOS] [YPOS] [WIDTH] [HEIGHT] [FRAME] [INTENSITY]
Effect: draws a box of the specified size at the specified position.
Parameters: For each parameter (XPOS, YPOS, WIDTH, HEIGHT and FRAME), both a measurement and a unit
of measure must be specified. The INTENSITY parameter should be entered as a percentage between 0 and
100.
&#61472;XPOS, YPOS: Upper left corner of the box, relative to the values of the POSITION command.
Default: Values specified in the POSITION command.
The following calculation is performed internally to determine the absolute output position of a box on the page:
X(abs) = XORIGIN + XPOS
Y(abs) = YORIGIN + YPOS
&#61472;WIDTH: Width of the box.
Default: WIDTH value of the SIZE command.
&#61472;HEIGHT: Height of the box.
Default: HEIGHT value of the SIZE command.
&#61472;FRAME: Thickness of frame.
Default: 0 (no frame).
&#61472;INTENSITY: Grayscale of box contents as %.
Default: 100 (full black)
Measurements: Decimal numbers must be specified as literal values (like ABAP/4 numeric constants) by being
enclosed in inverted commas. The period should be used as the decimal point character. See also the examples
listed below.
Units of measure: The following units of measure may be used:
&#61472;TW (twip)
&#61472;PT (point)
&#61472;IN (inch)
&#61472;MM (millimeter)
&#61472;CM (centimeter)
&#61472;LN (line)
&#61472;CH (character).

The following conversion factors apply:


&#61472;1 TW = 1/20 PT
&#61472;1 PT = 1/72 IN
&#61472;1 IN = 2.54 CM
&#61472;1 CM = 10 MM
&#61472;1 CH = height of a character relative to the CPI specification in the layout set header
&#61472;1 LN = height of a line relative to the LPI specification in the layout set header
Examples:
/: BOX FRAME 10 TW
Draws a frame around the current window with a frame thickness of 10 TW (= 0.5 PT).
/: BOX INTENSITY 10
Fills the window background with shadowing having a gray scale of 10 %.
/: BOX HEIGHT 0 TW FRAME 10 TW
Draws a horizontal line across the complete top edge of the window.
/: BOX WIDTH 0 TW FRAME 10 TW
Draws a vertical line along the complete height of the left hand edge of the window.
/: BOX WIDTH '17.5' CM HEIGHT 1 CM FRAME 10 TW INTENSITY 15
/: BOX WIDTH '17.5' CM HEIGHT '13.5' CM FRAME 10 TW
/: BOX XPOS '10.0' CM WIDTH 0 TW HEIGHT '13.5' CM FRAME 10 TW
/: BOX XPOS '13.5' CM WIDTH 0 TW HEIGHT '13.5' CM FRAME 10 TW
Draws two rectangles and two lines to construct a table of three columns with a highlighted heading section.
POSITION
Syntax:
/: POSITION [XORIGIN] [YORIGIN] [WINDOW] [PAGE]
Effect: Sets the origin for the coordinate system used by the XPOS and YPOS parameters of the BOX command.
When a window is first started the POSITION value is set to refer to the upper left corner of the window (default
setting).
Parameters: If a parameter value does not have a leading sign, then its value is interpreted as an absolute value,
in other words as a value which specifies an offset from the upper left corner of the output page. If a parameter
value is specified with a leading sign, then the new value of the parameter is calculated relative to the old value.
If one of the parameter specifications is missing, then no change is made to this parameter.
&#61472;XORIGIN, YORIGIN: Origin of the coordinate system.
&#61472;WINDOW: Sets the values for the left and upper edges to be the same of those of the current window
(default setting).
&#61472;PAGE: Sets the values for the left and upper edges to be the same as those of the current output page
(XORIGIN = 0 cm, YORIGIN = 0 cm).
Examples:
/: POSITION WINDOW
Sets the origin for the coordinate system to the upper left corner of the window.
/: POSITION XORIGIN 2 CM YORIGIN '2.5 CM'
Sets the origin for the coordinate system to a point 2 cm from the left edge and 2.5 cm from the upper edge of the
output page.
/: POSITION XORIGIN '-1.5' CM YORIGIN -1 CM
Shifts the origin for the coordinates 1.5 cm to the left and 1 cm up.
SIZE
Syntax:

/: SIZE [WIDTH] [HEIGHT] [WINDOW] [PAGE]


Effect: Sets the values of the WIDTH and HEIGHT parameters used in the BOX command. When a window is
first started the SIZE value is set to the same values as the window itself (default setting).
Parameters: If one of the parameter specifications is missing, then no change is made to the current value of this
parameter. If a parameter value does not have a leading sign, then its value is interpreted as an absolute value. If
a parameter value is specified with a leading sign, then the new value of the parameter is calculated relative to
the old value.
&#61472;WIDTH, HEIGHT: Dimensions of the rectangle or line.
&#61472;WINDOW: Sets the values for the width and height to the values of the current window (default
setting).
&#61472;PAGE: Sets the values for the width and height to the values of the current output page.
Examples:
/: SIZE WINDOW
Sets WIDTH and HEIGHT to the current window dimensions.
/: SIZE WIDTH '3.5' CM HEIGHT '7.6' CM
Sets WIDTH to 3.5 cm and HEIGHT to 7.6 cm.
/: POSITION WINDOW
/: POSITION XORIGIN -20 TW YORIGIN -20 TW
/: SIZE WIDTH +40 TW HEIGHT +40 TW
/: BOX FRAME 10 TW
A frame is added to the current window. The edges of the frame extend beyond the edges of the window itself, so
as to avoid obscuring the leading and trailing text characters.

You might also like