Application Development and Automation 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: 
Read only

SAP Script - How to write data in a table format.

Former Member
0 Likes
1,454

Hi All,

In my requirement, I need to show item data in a table format ( In a box, with horizental & veritcal lines.

can somebody pl give me a small code to do this.

Regards,

Hardik

6 REPLIES 6
Read only

Former Member
0 Likes
889

Hai,

For that u have to write codings in the line editor using BOX statement for drawing Vertical & Horizontal Lines.

Regards,

Padmam.

Read only

0 Likes
889

Hi ,

Yah .. I know that. usign that I am getting horizental lines fine. bt not getting vertical lines properly.

in abap help docu, there is something paragraph format and tab setting mentioned for table format...

can that fit in for my requirement?

Pl help

Hardik

Read only

Former Member
0 Likes
889

Hi

SCRIPT BOXES

POSITION WINDOW

SIZE WIDTH '160' MM HEIGHT '140' MM

BOX FRAME 10 TW

  • Box

BOX HEIGHT '11' MM WIDTH '160' MM FRAME 10 TW INTENSITY 35

  • linessssssss

BOX XPOS '20' MM WIDTH 0 TW HEIGHT '140' MM FRAME 10 TW

BOX XPOS '45' MM WIDTH 0 TW HEIGHT '140' MM FRAME 10 TW

BOX XPOS '80' MM WIDTH 0 TW HEIGHT '140' MM FRAME 10 TW

BOX XPOS '120' MM WIDTH 0 TW HEIGHT '140' MM FRAME 10 TW

Boxes, Lines, Shading: BOX, POSITION, SIZE

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:

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

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

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

BOX Command

Syntax

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

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

Parameters: 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

WIDTH

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

HEIGHT

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

FRAME

Thickness of frame.

Default: 0 (no frame).

INTENSITY

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

/: 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 shading 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 Command

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

/: 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 Command

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.

WIDTH, HEIGHT

Dimensions of the rectangle or line.

WINDOW

Sets the values for the width and height to the values of the current window (default setting).

PAGE

Sets the values for the width and height to the values of the current output page.

/: 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.

<REMOVED BY MODERATOR>

Regards

Anji

Edited by: Alvaro Tejada Galindo on Jul 8, 2008 10:59 AM

Read only

Former Member
0 Likes
889

hi,

make the use of Frames and boxes.

write this in the text element of the window of that form.

check the sysntax:

BOX

Draws a box

Syntax:

/: BOX <xpos> <ypos> <width> <height> <frame> <intensity>

The intensity is the grey scale of the box as %. The frame parameters is the thickness of the frame. Default is 0.

Each of the paramteters ypos, xpos, width, height and frame muts be followed of the measurement unit:

TW (twip)

PT (point)

IN (inch)

MM (millimeter)

CM (centimeter)

LN (line)

CH (character).

Examples:

/: BOX XPOS '11.21' MM YPOS '5.31' MM HEIGHT '10' MM WIDTH '20' MM INTENSITY 10 FRAME 0 TW

/: 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 shading 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 and SIZE

You can use the POSITION and SIZE commands to set default parameters for a box. This can be useful if you

have several boxes that share the same parameters.

Example:

/: POSITION XORIGIN '11.21' YORIGIN '5.31' MM

/: SIZE HEIGHT '2' MM WIDTH '76' MM

/: BOX FRAME 10 TW INTENSITY 10

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 relatively to the last used position

/: POSITION XORIGIN '10' MM YORIGIN '20' MM

Now the position will be X = 15 and Y = 30

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

Drawing a line

You can draw a line by setting the Height or Width of a box to 0 and add a frame. 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

/: 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.

Read only

former_member196280
Active Contributor
0 Likes
889

Use box statment.

Ex.

BOX xpos ypos width height frame

<REMOVED BY MODERATOR>

Regards,

SaiRam

Edited by: Alvaro Tejada Galindo on Jul 8, 2008 11:00 AM

Read only

Former Member
0 Likes
889

Try creating similar code..

for displaying properly u need to create paragraph format (eg. T1) and set the tab spacing in it according to the size of the fields u r displaying.

Then use this paragraph format in the control commands of the text element for ur fields.

/: SIZE WINDOW

/: BOX FRAME 10 TW

/E HEAD

<i>T1 Item No,,Mat No,,Decription,,Quantity,,Net Value</i>

/: POSITION WINDOW

/: BOX YPOS '2.0' LN WIDTH '67.70' CH FRAME 10 TW

/: BOX XPOS '10.0' CH WIDTH '0.0' CH HEIGHT '27.38' LN FRAME 10 TW

/: BOX XPOS '18.0' CH WIDTH '0.0' CH HEIGHT '27.38' LN FRAME 10 TW

/: BOX XPOS '38.0' CH WIDTH '0.0' CH HEIGHT '27.38' LN FRAME 10 TW

/: BOX XPOS '50.0' CH WIDTH '0.0' CH HEIGHT '27.38' LN FRAME 10 TW

/E BODY

<i>T1 &it_vbrp-posnr&,,&it_vbrp-matnr&,,&it_vbrp-arktx(15)&,,&it_vbrp-fkimg&,,

= &it_vbrp-netwr& </i>