Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

sap script

Former Member
0 Kudos
425

how can we create boxes in sapscript ie suppose if we want to print data in boxess how can we create it?

6 REPLIES 6

Former Member
0 Kudos
251

Hi Naga,

Use BOX command to create box and write your statement after BOX command.

<b>BOX:</b> These commands are used for drawing boxes and are used only during creating output.

Syntax:

/: BOX [Xpos] [Ypos] [Width] [Height] [Frame] [Intensive]

X & Y – Upper left corner of the box.

Width – Width of the box

Ht – Height of the box

Frame – Thickness of the box (Default is full black)

Units used for Width, Height and Thickness are TW, PT, IN, CM, CH, LN.

<b>/: BOX WIDTH ‘20’ CM HEIGHT 1 IN FRAME 10 TW INTENSIFY 15

/: 'MATERIAL: ' &V_MATNR&

/: 'DESC:' &V_DESC&</b>

Thanks,

Vinay

Former Member
0 Kudos
251

Hi,

See the sample to create a box

change the numbers as per the size

/: POSITION WINDOW

/: POSITION XORIGIN '-0.5' CH YORIGIN '-0.25' LN

/: SIZE WIDTH '+0.4' CH HEIGHT +1 LN

/: BOX FRAME 10 TW

/: BOX HEIGHT '1.7' LN INTENSITY 20

reward if useful

regards,

ANJI

Former Member
0 Kudos
251

HI Naga

<b>Boxes, Lines, Shading: BOX, POSITION, SIZE </b>

Use the BOX, POSITION, and SIZE commands for drawing boxes, lines, and shading to print particular windows within a form or passages of text within a window in a frame or with shading.

The SAP printer drivers that are based on page-oriented printers (the HP LaserJet driver HPL2, the Postscript driver POST, the Kyocera Prescribe driver PRES) employ these commands when printing. Line printers and page-oriented printers not supported in the standard ignore these commands. You can view the resulting printer output in the SAPscript print preview.

Syntax:

<b>/: BOX [XPOS] [YPOS] [WIDTH] [HEIGHT] [FRAME] [INTENSITY]

/: POSITION [XORIGIN] [YORIGIN] [WINDOW] [PAGE]

/: SIZE [WIDTH] [HEIGHT] [WINDOW] [PAGE]</b>

BOX Command

Syntax

<b>/: BOX [XPOS] [YPOS] [WIDTH] [HEIGHT] [FRAME] [INTENSITY]</b>

Effect: draws a box of the specified size at the specified position.

<b>

Parameters</b>: For each of XPOS, YPOS, WIDTH, HEIGHT, and FRAME, you must specify both a measurement and a unit of measurement. Specify the INTENSITY parameter as a percentage between 0 and 100.

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

<b>WIDTH</b>

Width of the box. Default: WIDTH value of the SIZE command.

<b>HEIGHT</b>

Height of the box. Default: HEIGHT value of the SIZE command.

<b>FRAME</b>

Thickness of frame.

Default: 0 (no frame).

<b>

INTENSITY</b>

Grayscale of box contents as %.

Default: 100 (full black)

Measurements: You must specify decimal numbers as literal values (like ABAP numeric constants) by enclosing them in inverted commas. Use the period as the decimal point character. See also the examples listed below.

Units of measurement: The following units of measurement may be used:

TW (twip)

PT (point)

IN (inch)

MM (millimeter)

CM (centimeter)

LN (line)

CH (character).

The following conversion factors apply:

1 TW = 1/20 PT

1 PT = 1/72 IN

1 IN = 2.54 CM

1 CM = 10 MM

1 CH = height of a character relative to the CPI specification in the form header

1 LN = height of a line relative to the LPI specification in the form header

<b>/: BOX FRAME 10 TW </b>

Draws a frame around the current window with a frame thickness of 10 TW (= 0.5 PT).

<b>/: BOX INTENSITY 10 </b>

Fills the window background with shading having a gray scale of 10 %.

<b>/: BOX HEIGHT 0 TW FRAME 10 TW </b>

Draws a horizontal line across the complete top edge of the window.

<b>/: BOX WIDTH 0 TW FRAME 10 TW </b>

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.

<b>POSITION Command</b>

Syntax

<b>/: POSITION [XORIGIN] [YORIGIN] [WINDOW] [PAGE]</b>

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 that 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.

XORIGIN, YORIGIN

Origin of the coordinate system.

WINDOW

Sets the values for the left and upper edges to match those of the current window (default setting).

PAGE

Sets the values for the left and upper edges to match those of the current output page (XORIGIN = 0 cm, YORIGIN = 0 cm).

If it helps reward with points

Regards Rk

Message was edited by:

Rk Pasupuleti

0 Kudos
251

/: POSITION XORIGIN '-0.5' CH YORIGIN '0.25' LN

this position comes in II ND QUADINATE (ACCORDING TO MATHS) BUT THE BOX IS DRAWN ON THE LEFT SIDE OF THE PAGE.

SUPPOSE IF I WANT ON THE RIGHT SIDE WHAT I MUST DO PLZ SOLVE THIS PROBLEM AND GIVE ME CORRECT ANSWER.

0 Kudos
251

Hi..

/: POSITION XORIGIN '0.5' CH YORIGIN '0.25' LN

Now u will get the box on the right side of the page.

here the reference is with respect to page.. that is the origin is set at the page corners.. so if u use the '-ve' values then the box comes left to the page.. if u use '+ve' then it comes on the right side of the page..

You can set the reference i mean the origin to a window in that page also.. by using the statement..

/: POSITION WINDOW.

NOW the origin becomes the left edge of the window !!

reward all helpful answers,

sai ramesh

Former Member
0 Kudos
251

Hi,

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

Regards,

Bhaskar