SAP SCRIPT CONTROLS 5

Setting a Header Text in the Main Window: TOP

You can use the TOP .. ENDTOP control command to specify lines of text which are always to be output at the top of the main window. These text lines are also known as header texts. An example of the use of header texts in the case of a very long table covering several pages of output would be to ensure that the table heading information were repeated at the start of each new page of output.

Syntax:

/: TOP
:
:
/: ENDTOP

The lines of text enclosed between the two control commands will be output from now on at the start of the main window.An existing header text can be disabled by using the TOP .. ENDTOP command pair without enclosing any text lines between the two command lines:

/: TOP
/: ENDTOP

Subsequent pages will contain no header text.


• If the main window already contains some output then a newly specified header text takes effect on the next page only.
• The same applies to the deletion of a header text. If a header text has already been output on the current page then it cannot be retracted.
• Header texts should not be employed in texts that are printed from applications programs, e.g. reminder texts, order texts, etc. These applications programs can also work with header texts via the layout set interface, which may lead to unexpected results.


Setting a Footer Text in the Main Window: BOTTOM

Footer texts may also be specified for the main window in a similar way to header texts. Footer texts are always output at the bottom of the window.
Syntax:


/: BOTTOM
:
:
/: ENDBOTTOM


The lines of text enclosed between the two control commands will be output from now on at the bottom of the main window.An existing footer text can be disabled by using the BOTTOM .. ENDBOTTOM command pair without enclosing any text lines between the two command lines:


/: BOTTOM
/: ENDBOTTOM


This and subsequent pages will contain no footer text.
• Assuming there is still sufficient space in the main window, a newly specified footer text will also be output on the current page.
• Footer texts should not be employed in texts that are printed from applications programs, e.g. reminder texts, order texts, etc. These applications programs can also work with footer texts via the layout set interface, which may lead to unexpected results.

Conditional Text: IF

You can use the IF control command to specify that text lines should be output only when certain conditions are met. If the logical expression contained within the IF command evaluates to be true, then the text lines enclosed by the IF ... ENDIF command pair will be output. Otherwise they are ignored.
Syntax:


/: IF condition
:
:
/: ENDIF


The logical expression can use the following the comparison operators:

• = EQ equal to
• <> GT greater than
• <= LE less than or equal to • >= GE greater than or equal to
• <> NE not equal to

The following logical connective operators can be used to combine conditions:

• NOT
• AND
• OR

Evaluation of both the individual logical expressions and of the combinations of expressions is performed strictly from left to right. There are no precedence rules. Bracketed expressions are not supported.

The comparison is always performed on literal values, i.e. the symbols are formatted as character strings before being compared rather than using the internal form. This is particularly significant in the case of program symbols, because the formatting of these may depend on various parameters.

For example, the formatted form of a currency field employs a variable number of decimal places and a variable 'decimal point' symbol (e.g. a period or a comma) depending on the applicable currency key.


The IF command may be extended with the ELSE command to allow text lines to be specified which are to be output in the case that the condition evaluates to be false. The text lines enclosed by the IF and ELSE commands are formatted if the condition is true; otherwise the text lines enclosed by the ELSE and ENDIF commands are formatted.

Syntax:
/: IF condition
:
/: ELSE
:
/: ENDIF
The ELSEIF command allows multiple cases to be specified.
Syntax:
/: IF condition
:
/: ELSEIF condition
:
/: ELSE
:
/: ENDIF
You can use arbitrarily many ELSEIF commands within one compound IF .. ENDIF control command. The use of an ELSE command is then optional.


• A condition may not occupy several lines. Both the IF or ELSEIF command and the attached condition must be completely contained within a single line.
• IF commands may be nested.
• An IF command must be terminated with an ENDIF command. If this is forgotten, then there will be no more output following the IF command if the condition evaluates to be false.


• If a syntax error occurs in the interpretation of this command, then the command will not be executed. This may have an unexpected effect on the subsequent text output. For example if the IF statement is incorrect, then all following ELSEIF and ELSE commands will be ignored, since the opening IF command is 'missing'. This will cause all the text lines attached to the ELSEIF and ELSE commands to be output.


The CASE command

The CASE command covers a special case of the multiple case IF command. Rather than allowing an arbitrary condition to be tested in each of the individual cases (as in the general multiple case IF command), the CASE command allows a given symbol to be tested against specific values until a matching value is found.


Syntax:
/: CASE symbol
/: WHEN value1
:
/: WHEN value2
:
/: WHEN valuen
:
/: WHEN OTHERS.
:
/: ENDCASE


The symbol in the CASE line is formatted. If its value is to be found in one of the WHEN lines, then the text lines following this WHEN line are output. If no matching value is found then the text lines enclosed by the WHEN OTHERS line and the ENDCASE command are output. The WHEN OTHERS section is optional.As in the case of the IF command, the comparison is always performed on literal values.


• A CASE command must be terminated by an ENDCASE command.
• The WHEN OTHERS section is optional.


Calling ABAP/4 Subroutines: PERFORM

You can use the PERFORM command to call an ABAP/4 subroutine (form) from any program, subject to the normal ABAP/4 runtime authorization checking. You can use such calls to subroutines for such purposes as carrying out calculations, obtaining data from the database that is needed at display or print time, format data, and so on.


PERFORM commands, like all control commands, are executed when a document is formatted for display or printing. Communication between a subroutine that you call and the document is by way of symbols whose values are set in the subroutine.


Syntax:
/: PERFORM IN PROGRAM
/: USING &INVAR1&
/: USING &INVAR2&
......
/: CHANGING &OUTVAR1&
/: CHANGING &OUTVAR2&
......
/: ENDPERFORM


INVAR1 and INVAR2 are variable symbols and may be of any of the four SAPscript symbol types.OUTVAR1 and OUTVAR2 are local text symbols and must therefore be character strings.

The form routine that you call with PERFORM may not contain any calls to the function modules of the SAPscript composer API (OPEN_FORM, WRITE_FORM, and so on).


Inserting Print Controls: PRINT-CONTROL

You can use this command to call certain printer functions from a SAPscript text. Although you cannot enter control characters for the printer directly in your text, you can define a print control via the spooler maintenance transaction SPAD that contains the printer commands you want. You can now call a print control using the PRINT-CONTROL SAPscript command.


Syntax:
/: PRINT-CONTROL name
Specify the name of the print control either with or without inverted commas.

• The contents of the print control called are transparent to SAPscript. SAPscript cannot check whether the printer commands contained in the control are correct. Therefore, if you experience problems when printing a text containing these commands, you should proceed by first trying to print the text without the print controls. Then, reintroduce the PRINT-CONTROL commands one by one until the command causing the problem is identified.


• You should ensure that the printer control sequences you define leave the printer afterwards in a well-defined state. SAPscript assumes that after completing each text output certain settings (e.g. font, current page) are still valid for subsequent printing. If your printer commands change these settings without resetting them again afterwards, the results may be unpredictable.

After executing a PRINT-CONTROL command SAPscript inserts a space character at the start of the next text line. If you do not want this, then you should give this text line the '=' paragraph format.


Boxes, Lines, Shading: BOX, POSITION, SIZE

The BOX, POSITION and SIZE commands for drawing boxes, lines and shadowing can be used for specifying that within a layout set particular windows or passages of text within a window are to be output in a frame or with shadowing.


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 outputting. Line printers and page-oriented printers not supported in the standard ignore these commands. The resulting printer output may be viewed in the SAPscript print previewer.
Syntax:

1. /: BOX [XPOS] [YPOS] [WIDTH] [HEIGHT] [FRAME] [INTENSITY]
2. /: POSITION [XORIGIN] [YORIGIN] [WINDOW] [PAGE]
3. /: 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 both a measurement and a unit of measurement must be specified. The INTENSITY parameter should be specified as a percentage between 0 and 100.

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

2. WIDTH: Width of the box. Default: WIDTH value of the SIZE command.
3. HEIGHT: Height of the box. Default: HEIGHT value of the SIZE command.
4. FRAME: Thickness of frame.

Default: 0 (no frame).

5. INTENSITY: Grayscale of box contents as % .

Default: 100 (full black)

Measurements: Decimal numbers must be specified as literal values (like ABAP 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 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 layout set header
• 1 LN = height of a line relative to the LPI specification in the layout set 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 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 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 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.

1. XORIGIN, YORIGIN: Origin of the coordinate system.
2. WINDOW: Sets the values for the left and upper edges to be the same of those of the current window (default setting).
3. PAGE: Sets the values for the left and upper edges to be the same of 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.

1. WIDTH, HEIGHT: Dimensions of the rectangle or line.
2. WINDOW: Sets the values for the width and height to the values of the current window (default setting).
3. 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.

RELATED POSTS

SAP SCRIPT CONTROLS 6

No comments :

Post a Comment