cancel
Showing results for 
Search instead for 
Did you mean: 

sap-script issue

Former Member
0 Kudos

Guy's

i am new to sap-script,i have found form name,and

program name using nace transcation,but when i activate

debugging option in my script ,it's will go to debugging

mode,but it won't call program ,even though i set

debugging on my program too,it's necessary for me to

understand ,how some of the field in sap-script is

getting populated,this is only possible if i know

how it's getting fetched from program

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

Hi Sanju

Data flows from driver program to SapScript. A script does not calls the program, instead driver programs calls the form for printing.

What should really happen is - it comes to write_form first and then goes inside script.

so, please check the parameters of write_form in the driver program first. And first of all see FM open_form to see the name of SapScript form it is using.

I fear that you may not be using correct combination of program and form. Or, some big programs use more than one SapScript form and they have multiple OPEN_FORM and WRITE_FORM.

So, please check it once again

Regards

Ashish Jain

So, once debugger goes inside SapScript,

Former Member
0 Kudos

Hi Sanju

Try to grasp more basics of SapScripts. Do some study on FM: write_form

See what are the parameters that are passed there. understand TEXT ELEMENTS, WINDOW

Definitely, you can try to read from documentations that other people have provided you as links.

Cheers

Ashish

Former Member
0 Kudos

HI

GOOD

HERE YOU HAVE NOT CLEARLY DEFINED WHAT IS YOUR REQUIREMENT IS SO I AM GIVING SOME LINKS OF SAP SCRIPT ,GO THROUGH THEM AND HOPE THIS WILL SOLVE YOUR PROBLEM.

http://help.sap.com/saphelp_nw04/helpdata/en/4f/9938e5446d11d189700000e8322d00/content.htm

http://www.ces.gatech.edu/adhocJITP02.PDF

WWW.SAPPOINT.COM

WWW.TRIPOD.COM

http://www.newalliance.com/SAPscript_for_ABAPers.htm

THANKS

MRUTYUN

Former Member
0 Kudos

u may have put a breakpoint in the program at the place which is not executed during runtime... wat is the program name that u r trying to debug?? make sure that the same program is configured in nace... also, from wher r u triggering the print?? u may put a /h in the command field and press enter before clicking the print option so that it will take u to debugging mode..

Regards,

Former Member
0 Kudos

Hai Sanju

Go through the following Document

The functionality of the SAPscript editor is determined by a number of commands, which you can either choose via the menu or call using function keys. They are used for editing the text in the editor accordingto your requirements, and the commands are executed immediately.

In contrast, SAPscript also recognizes another type of commands, the control commands . These have the task of correspondingly influencing the output formatting.They are not interpreted by the SAPscript editor, but only affect the SAPscript Composer. The Composer is the program, which converts your text from the editor display into the print display. This performs, among other things, the line formatting and the formatting of pages, symbols are replaced by their current values and the text is formatted according to the paragraph format and the character style format.The control commands possible in SAPscript are described below:

Overview of Control Commands

ADDRESS Formatting of addresses

BOTTOM, ENDBOTTOM Define footer text in a window

BOX, POSITION, SIZE Boxes, lines and shading

CASE, ENDCASE Case distinction

DEFINE Value assignment to text symbols

HEX, ENDHEX Hexadecimal values

IF, ENDIF Conditional text output

INCLUDE Include other texts

NEW-PAGE Explicit forms feed

NEW-WINDOW Next window MAIN

PRINT-CONTROL Insert print control character

PROTECT, ENDPROTECT Protect from page break

RESET Initialize outline paragraphs

SET COUNTRY Country-specific formatting

SET DATE MASK Formatting of date fields

SET SIGN Position of +/- sign

SET TIME MASK Formatting of time fields

STYLE Change style

SUMMING Summing variables

TOP Set header text in window MAIN

Overview of Formatting Options

Formatting options are used to format variables if they should not be formatted as described in the Dictionary. Formatting options are always specified within the &-& brackets of variables.

Exponent for floating point numbers Specifying an exponent for floating point values

Fill characters Replacing leading spaces with fill characters

Ignoring conversion rules Ignoring conversion rules from Dictionary

Leading sign to the left Leading sign of numeric values is on the left

Leading sign to the right Leading sign of numeric values is on the right

Number of decimals Specifying the number of decimal places

Offset Specifying an offset of n characters

Omitting leading zeros Omitting the leading zeros

Omitting the leading sign Omitting the leading sign of numeric values

Omitting the separator for ‘Thousands’ Omitting the separator for ‘Thousands’ in . numeric values

Output length Specifying the output length

Preceding and subsequent text Specifying preceding and subsequent text for . variables

Right-justified output Right-justified output within a specified output . length

Space compression Reducing spaces between words of one variable

Suppressing initial values Suppressing output of initial values

Syntax of Control Commands

SAPscript control commands are entered, changed or deleted in the SAPscript editor in the same way as all other text lines. However, they differ from normal lines in respect to the following points:

•Control commands must be indicated by the paragraph format /: in the tag column.

•You enter the command itself in the line. All key words and all specifications, which are not defined in quotes as literal, are automatically converted to upper case.

•One line must contain the complete control command with all the necessary parameters.

•Only one control command is allowed per line.

•Lines with control commands are not affected by the editor formatting.

If the control command is unknown or syntactically incorrect, the command line is treated as a comment line, that is, it is not interpreted or printed.If a parameter of a control command is written in parentheses [] on the following pages, then this parameter is optional.

Some of the control commands are global settings. These are valid until they

are explicitly switched off. Therefore it’s important to know that window

MAIN is always processed first on a page. For example, if you want to set

the date format with the control command SET DATE FORMAT and this

format should be valid for the whole layout set, then it’s important to

specify this command on top of window MAIN.

ADDRESS: Formatting of addresses

The command ADDRESS - ENDADDRESS formats an address according to the postal standards of the

destination country defined in the parameter COUNTRY. The reference fields are described in the

structure ADRS. Both constants and symbols can be assigned to the parameters.

Syntax:

/: ADDRESS [DELIVERY] [PARAGRAPH a] [PRIORITY p] [LINES l]

/: TITLE title

/: NAME name1[,name2[,name3[,name4]]]

/: STREET street

/: POBOX PO box [CODE zip code]

/: POSTCODE zip code

/: CITY town1[,town2]

/: REGION region

/: COUNTRY country

/: FROMCOUNTRY from country

/: ENDADDRESS

Both formatting data and address data are given as parameters. Address data is formatted for output in accordance with the parameters COUNTRY, PRIORITY and LINES. If available, the P.O. box is used instead of the street as the default.

•DELIVERY: Defines the street address. If this parameter is selected, the system prints the street address on the layout output instead of the P.O. box.

•PARAGRAPH: Defines in which paragraph format the address is output. If the parameter is not defined, the address is output in the default paragraph format.

•PRIORITY: Defines which address lines can be omitted if necessary. You can enter a combination of the following values:

A form of address

P mandatory blank line 1

Q mandatory blank line 2

2 name2

3 name3

4 name4

L name of country

S line for the street

O line for the city

•LINES: Defines how many lines are available for formatting the address. If all the address data cannot be formatted due to an insufficient number of lines, the data entered in the parameter PRIORITY is omitted. If the LINES specification is missing and this command is in a layout set window whose type is not MAIN, the lines available for the address layout are then calculated automatically by means of the current output line item and window size.

•TITLE: Required form of address.

•NAME: Up to four separate names, separated by commas, can be defined.

•STREET: Street specification including address number.

•POBOX: Post Office box number.

•CODE: P.O. box Postal or ZIP code if it is different from the postal code of the city.

•POSTCODE: Postal or ZIP code of the city.

•CITY: Up to two place names can be defined.

•REGION: Determines the administrative area.

•COUNTRY: Specifies the country according to whose specific postal standards the address is formatted.

•FROMCOUNTRY: Defines in which language the name of the destination country is formatted. In EC countries, only the international country identification letter is put before the postal code with a hyphen.

Example:

/: ADDRESS

/: TITLE ‘Company’

/: NAME ‘Widget Technology, Inc.’, ‘All Kind of Widgets’

/: STREET ‘1005 Lido Lane’

/: POBOX ‘2935’ CODE ‘94400’

/: POSTCODE ‘94404’

/: CITY ‘Foster City’

/: REGION ‘CA’

/: COUNTRY ‘USA’

/: FROMCOUNTRY ‘USA’

/: ENDADDRESS

Generates the following address:

Company

Widget Technology, Inc.

All Kind of Widgets

PO box 2935

Foster City, CA 94400

If the supplement DELIVERY is specified for the command ADDRESS, then the street is entered instead of

the PO box.

Company

Widget Technology, Inc.

All Kind of Widgets

1005 Lido Lane

Foster City, CA 94404

SAPscript calls the function module ADDRESS_INTO_PRINTFORM for

formatting the address. If the display is not in the required form, please

check the settings valid for this function module (see the documentation on

the function module).

BOTTOM: Define footer text in a window

For the window MAIN, you can determine lines which are always output automatically at the bottom of

that window. These lines are also called footer texts.

Syntax:

/: BOTTOM

:

:

/: ENDBOTTOM

The text lines between the two commands are output at the bottom of the window MAIN.

If you want to switch a footer text off again, enter the command pair BOTTOM .. ENDBOTTOM without

any text lines in between:

/: BOTTOM

/: ENDBOTTOM

Footer text no longer appears at the bottom of the page from and including this page.

If there is sufficient space in the window, a footer text is output on the

current page.

You should only use footer texts in texts that are not printed via application

programs, for example, dunning texts, ordering texts, and so on. These

application programs can also work with footer texts via the layout set

interface, which can lead to unwanted results.

BOX, POSITION, SIZE: Boxes, lines, shading

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

The SAP printer drivers that are based on page-oriented printers (the HP LaserJet PCL-5 driver HPLJ4, the

Postscript driver POST, the Kyocera Prescribe driver PRES) employ these commands when creating output. Line printers and non-supported page-oriented printers ignore these commands. The resulting 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

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.

•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: 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:

•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

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.

•XORIGIN, YORIGIN: Origin of the coordinate system.

•WINDOW: Sets the values for the left and upper edges to be the same of those of the current window (default setting).

•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.

•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.

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.

CASE: Case distinction

The CASE command can be regarded as a special case of multi-level case distinction with IF commands.

As a condition for the different cases, only one symbol can be queried for equality with different values.

Syntax:

/: CASE symbol

/: WHEN value1

:

/: WHEN value2

:

/: WHEN value n

:

/: WHEN OTHERS.

:

/: ENDCASE

The symbol entered in the CASE line is formatted. If it has a value which is specified in the individual WHEN lines, the text following the valid WHEN line is output. If none of the listed values apply, the lines between the WHEN-OTHERS line and ENDCASE are output. The WHEN-OTHERS case is optional. Comparison is always carried out as a literal comparison as for the IF command.

•A CASE command must always be ended by ENDCASE.

•The WHEN-OTHERS command is optional.

DEFINE: Value assignment to text symbols

Text symbols receive their value through an explicit assignment. This assignment can be made interactively in the editor via the menu options Include Symbols Text. This lists all the text symbols of a text module, as well as those of the allocated layout set.

The contents defined in this way are lost if the transaction is exited. To continue printing the text module, you would have to enter the symbol values again.The DEFINE command allows you to anchor this value assignment firmly in the text, to also have it available when you next call up the text. Furthermore, you can allocate another value to a text symbol in

the course of the text.

Syntax:

/: DEFINE &symbolname& = ‘value’

Example:

/: DEFINE &re& = ‘Your correspondence of 3/17/94’

Example:

/: DEFINE &symbol1& = ‘xxxxxxx’

/: DEFINE &symbol2& = ‘yyy&symbol1&’

/: DEFINE &symbol1& = ‘zzzzzzz’

Result: &symbol2& yyyzzzzzzz

The assigned value may have a maximum of 60 characters. It can also contain further symbols. When a symbol is defined using the control command DEFINE, symbols which occur in the value are not immediately replaced by their value. They are only replaced when the target symbol is output. If the operator := is used in the DEFINE statement, all symbols which occur in the value which is to be assigned are immediately replaced by their current values. The resulting character string is only then assigned to the target symbol when all occurring symbols have been replaced. The length of the value is limited to 80 characters. The target symbol must be a text symbol, as at present.

Syntax:

/: DEFINE &symbolname& := ‘value’

HEX: Hexadecimal Data

This command can be used to send printer commands in a printer language directly to a printer that supports that language. SAPscript does not interpret the data enclosed by the HEX and ENDHEX command pair, but inserts it unchanged into the output stream. This technique allows objects with a pixel-oriented format (e.g. graphics) to be printed as part of a SAPscript text. The HEX and ENDHEX command pair enclose the printer commands and data as hexadecimal text, so that the printer formatting routines interpret each successive pair of characters as a single hexadecimal value in the range 0..255. The characters 0..9 and A..F for representing the values 10..15 are valid hexadecimal characters. The text may also include comment lines (these begin with /* in the format column), which will not be interpreted as hexadecimal data but are simply passed over by the formatting routines.

Syntax:

/: HEX [TYPE printer_language]

:

:

/: ENDHEX

The HEX command denotes the start of the hexadecimal data. Subsequent text lines are interpreted as described above. If the TYPE parameter is present, the data will be sent to the printer only if the printer understands the specified printer language. The following printer languages are currently supported:

POST (Postscript), PRES ( Kyocera Prescribe) and PCL (HP Printer Control Language).

/: HEX [TYPE printer_language] [XPOS x_position] [YPOS y_position]

The output cursor is set to the absolute position indicated by the specified X and Y position parameters before the hexadecimal data is output. If either the X or the Y position is not specified, then 0 will be assumed for this parameter.

/: HEX [TYPE printer_language] [HEIGHT height] [LEFT left_indentation]

The HEIGHT parameter determines the amount of space to be reserved on the page for the output of the hexadecimal data. Any text following the ENDHEX command will be output below this point. If the LEFT parameter is also specified, then the output of the hexadecimal data will be indented from the left margin by the specified amount.

Examples:

/: HEX TYPE PCL HEIGHT '7.5' CM LEFT '2.25' CM

/* Creator: report ZQVNTE30 date 19940705 time 125129 user SAPSCRIPT

/= 1B2A7230461B2A743735521B2A7231411B2A62304D1B2A62343057FFFFFFFFFFFF

/= FF1B2A62343057FFFFFFFFFFFFC0007D00DFC0F7D0000000000000000000000017

/: ENDHEX

This data will be printed only by an HP PCL printer (e.g. HP LaserJet). 7.5 cm of space will allocated on the page for the output of the data and the output cursor will be indented 2.25 cm to the right of the layout set window edge.

The RSTXLDMC program may be used to upload correctly formatted pixel

data to the R/3 system and to prepare it as a HEX-ENDHEX control

command. This can then be saved as normal SAPscript text.

IF: Conditional text output

With the IF control command, you can define that lines are only output under certain conditions . If the logical expression entered for the IF command is fulfilled, the lines parenthesized by IF ... ENDIF are output, otherwise they are ignored.

Syntax:

/: IF Condition

:

:

/: ENDIF

In the condition the following relational operators are possible:

•= or EQ equals

•&#61472;< or LT less than

•&#61472;> or GT greater than

•&#61472;<= or LE less than or equal to

•&#61472;>= or GE greater than or equal to

•&#61472;<> or NE not equal

As logical link operators, you can use:

•&#61472;NOT

•&#61472;AND

•&#61472;OR

The sequence of processing the logical operations and the sequence of processing the conditions is always from left to right. There is no order of binding. Bracketing is not allowed.

Comparison is always carried out as a literal comparison, that is, symbols are compared in their formatted form as a character string and not with their internal representation. This must particularly be taken into account for program symbols whose format depends on different parameters. Currency fields which are output with different numbers of places after the decimal point depending on the currency key, or which have a comma or a period as the decimal separator depending on the setting are used here as examples.The IF command can be extended to make a two-sided case distinction using the ELSE command. If the

specified IF condition is true, then the lines listed between IF and ELSE are formatted, otherwise the lines between ELSE and ENDIF are formatted.

Syntax:

/: IF Condition

:

/: ELSE

:

/: ENDIF

A multi-level case distinction is possible using the ELSEIF command.

Syntax:

/: IF Condition

:

/: ELSEIF Condition

:

/: ELSE

:

/: ENDIF

You can use as many ELSEIF commands as required. The specification of an ELSE command is optional in

this case.

•&#61472;The condition must not extend over several lines, but must be contained

in one line together with the IF or ELSEIF command.

•&#61472;IF commands can also be nested.

•&#61472;An IF command must always be ended by ENDIF. If this is forgotten,

nothing more is output after the IF command, if the condition is not true.

•&#61472;If a syntax error is found when interpreting these commands, the

corresponding command is not executed. This can have various effects

on the following text output. If, for example, the IF statement is

incorrectly structured, then the following ELSEIF or ELSE commands

are ignored since the opening IF is missing. All lines are output in this

case.

INCLUDE: Include other texts

With the command INCLUDE, you can include the contents of another text into your text. The text to be included exists separately from yours and is only copied at the time of the output formatting.With the INCLUDE command, you always get the most current version of the required text, since this is only read and inserted during the output formatting.

Syntax:

/: INCLUDE name [OBJECT o] [ID i] [LANGUAGE l] [PARAGRAPH p] [NEW-PARAGRAPH np]

The name of the text to be inserted must be specified and can have up to a maximum of 70 characters. If the text name contains blanks, then you must put it in quotes as a literal. It can also be specified via a symbol. All further parameters of the INCLUDE command are optional. If they are missing, SAPscript uses default values for them which are based on the respective call environment.

Examples:

/: INCLUDE MYTEXT

The text MYTEXT is included in the language of the calling text.

/: INCLUDE MYTEXT LANGUAGE ‘E’ PARAGRAPH ‘A1’

The text with the name MYTEXT and the language E is included, regardless of in which language the calling text is created. The paragraph format A1 is valid as the standard paragraph for this call.

Optional specifications:

•&#61472;LANGUAGE If a language is not specified, the language of the calling text or the layout set is set for the text to be included. If a language is specified, the text is always loaded in this language, regardless of the language of the calling text.

•&#61472;PARAGRAPH The text to be included is formatted with the style allocated to it. With this parameter, the standard paragraph of this style can be redefined for the current call. All * paragraphs of the inserted text are then formatted with the paragraph specified here.

•&#61472;NEW-PARAGRAPH The first line of the included text has this format flag, provided it is not a command or comment line. If the optional entry PARAGRAPH (see above) is empty, all * paragraphs of the included text are formatted with the paragraph np specified with

NEW-PARAGRAPH.

•&#61472;OBJECT To specify a text completely, you must make further specifications regarding the text object. There are different rules and restrictions for this which depend on the object type of the calling text: All texts can be included in a layout set. If no object is entered here, TEXT is used (standard texts).With a documentation text (object DOKU), you can only include documentation texts. This object is assumed even if no object is specified in this environment. Only hypertext or documentation text can be included into a hypertext (object DSYS). If the OBJECT specification is missing, DSYS is set as a default value.

Only standard text (object TEXT), documentation text or hypertext can be included in any other type of text. The default object is TEXT if nothing is entered.

•&#61472;ID The text ID, which allows further text types within an object, is a further part of the text key. If the ID is not entered, the default Include ID from table TTXID is used for the calling text. If the specification is not in this table, the text ID of the calling text is used.

The ID together with the object are now the basis of a further consistency check:

•&#61472;All text IDs are allowed for a layout set.

•&#61472;Only documentation texts with the text IDs TX (general texts), UO (authorization objects), and documentation texts which have the same text ID as the calling documentation text may be included in documentation texts.

•&#61472;All DSYS texts may be included in DSYS texts, regardless of their ID. Documentation texts to be inserted may only have IDs TX and UO.

•&#61472;Standard texts with all the allowed text IDs, DSYS texts with all IDs, and documentation texts with Ids TX and UO may be included in the other types of texts.

NEW-PAGE: Explicit form feed

SAPscript automatically carries out a page break if window MAIN of one page is filled. With the command NEW-PAGE, you can force a page break at any point within a text. The text following this command is then written on a new page. The form feed is always carried out and is not dependent on any conditions. The command finishes the current page, that is, all the windows that are still on the page are output now. If you have entered the command NEW-PAGE without any further parameters, the page which is defined in the layout set as the next page to the current page is accessed. If, however, you have various pages in your layout set, you can jump to a particular next page by specifying a page name.

Syntax:

/: NEW-PAGE [page name]

Examples:

/: NEW-PAGE

The current page is completed and the text in the following lines is written on the next page determined in the layout set.

/: NEW-PAGE S1

Same as before. However, the page with the name S1 is accessed as the next page.

•&#61472;If an explicitly specified page for the NEW-PAGE command is not

contained in the layout set, this page specification is ignored.

•&#61472;Make sure that there are no blank lines immediately before a NEW-PAGE

command. This could lead to an unwanted empty page being printed if

an implicit form feed was carried out within these blank lines.

NEW-WINDOW: Next window MAIN

You can have up to 99 windows MAIN on one page. They are distinguished by a serial number (0..98) and also assigned in this order. It is thus possible to print labels or to output text in multiple columns with SAPscript. If window MAIN is filled, then the next window MAIN on the page is accessed automatically if such exists. A page break is carried out at the end of the last window MAIN. With the command NEW-WINDOW, you can explicitly call the following window MAIN even if the current window is not yet completely filled. If you are currently in the last window MAIN of the page, the command works as a NEW-PAGE.

Syntax:

/: NEW-WINDOW

PRINT-CONTROL: Insert print control character

This command allows you to call certain functions of the printer from a SAPscript text. You cannot enter the control characters for the printer directly into your text. You have to define a print control which contains the printer commands that you require via the spool maintenance transaction SPAD. This print control can now be called via the SAPscript command

PRINT-CONTROL.

Syntax:

/: PRINT-CONTROL name

The name of the required print control can be entered with or without quotes.

•&#61472;SAPscript has no idea of what is contained in the print control. It cannot

check whether the printer commands hidden behind it are functional. If

problems then result when printing such a text, first try to print the text

without the print controls, and then activate the individual PRINT-CONTROL

commands one after the other, to help you locate the error

more easily.

•&#61472;You must make sure that the print control sequences that you define

restore the printer to a defined status upon completion. When printing

subsequent texts, SAPscript assumes that certain settings are still valid

(type font, current page). If these settings are changed by the called

printer commands, this can have unwanted effects.

After performing the PRINT-CONTROL command, SAPscript inserts a blank at the start of the following line. If this is not required, this line must have the paragraph format ‘=’.

PROTECT: Protect from page break

You can determine that a paragraph must not be separated by a page break in the style or layout set. If the attribute page protection is set, then all the lines of this paragraph are always output together on one page. This attribute is linked to the respective paragraph.

It certainly does not make sense, to provide all the paragraphs with a page protection attribute to neutralize an unwanted page break. This event is much too dynamic for this and only results from the current text. Furthermore, it can also happen that you only want to protect parts of a paragraph from a page break. In principle, you could solve this problem using the command NEW-PAGE, by explicitly starting a new page before the affected parts of the text. However, this procedure is not very easy to make changes to. Assume that you have formatted your text using the NEW-PAGE command so that you have no unwanted

page breaks. If you now insert new lines or delete existing ones, you would have to check all the NEW-PAGE commands inserted after this point in the text, as changes can result in the movement of page breaks. With the command pair PROTECT. ENDPROTECT, SAPscript offers you the option of individually defining protection from a page break. If you parenthesize the text in question using these commands, SAPscript automatically guarantees that all the lines it contains are printed together on one page. If the lines fit on the current output page, they are output there, in exactly the same way as if the PROTECT

command was not used. If, however, the space is not sufficient, the PROTECT command then works as a NEW-PAGE and generates a form feed .For this reason, you can view PROTECT/ENDPROTECT as a conditional NEW-PAGE command, whose condition consists of whether the included lines fit into the current window MAIN or not.

Syntax:

/: PROTECT

:

:

/: ENDPROTECT

The lines to be protected lie between the two commands.

•&#61472;An ENDPROTECT command without a preceding PROTECT command

is ineffective.

•&#61472;If the last ENDPROTECT is missing, it is implicitly assumed at the end

of the text.

•&#61472;PROTECT .. ENDPROTECT commands cannot be nested. If a second

PROTECT command is recognized while another is active, the second is

ignored.

•&#61472;If the text between PROTECT and ENDPROTECT is so extensive that it

would not completely fit on an empty page, then only one form feed is

generated and the text is then output normally. Thus, in this case, the

section to be protected can be separated by a page break.

RESET: Initialize outline paragraphs

The RESET command causes the numbering of an outline paragraph to be reset to its initial value. If the user does not use RESET, all the outline paragraphs of a text are numbered sequentially. If the name of an outline paragraph is entered in the RESET command, the numbering of this paragraph is initialized including the paragraphs with subordinate outline levels.

Syntax:

/: RESET paragraph format

The paragraph format specifies the outline paragraph to be initialized.

Example:

Assume that the paragraph N1 is defined in the style that you are using. This paragraph should be used for listings and it each time generates the output of a list number. This is the SAPscript editor:

•&#61472;AS If you want to work with the SAP R/3 System, proceed as follows:

•&#61472;N1 Make sure that you have a PC

•&#61472;N1 Switch on the PC

•&#61472;N1 Click on the SAP icon with the mouse.

•&#61472;AS You then reach the SAP logon screen. To log on, you must carry out the following steps:

•&#61472;/: RESET N1

•&#61472;N1 Enter your user ID

•&#61472;N1 Enter your password

•&#61472;N1 Choose the application you require

This text would give the following output:

If you want to work with the SAP R/3 System, proceed as follows:

1. Make sure that you have a PC

2. Switch on the PC

3. Click on the SAP icon with the mouse.

You then reach the SAP logon screen. To log on, you must carry out the following steps:

1. Enter your user ID

2. Enter your password

3. Choose the application you require

If the RESET command between the two lines was missing, then both of the listings would be sequentially numbered:

If you want to work with the SAP R/3 System, proceed as follows:

1. Make sure that you have a PC

2. Switch on the PC

3. Click on the SAP icon with the mouse.

You then reach the SAP logon screen. To log on, you must carry out the following steps:

4. Enter your user ID

5. Enter your password

6. Choose the application you require

SET COUNTRY: Country-specific formatting

Some field types are formatted country-specifically . This includes, on the one hand, the display of a date,the display of the decimal point or the thousands separator. Normally, the display types defined in the user master record are used here. With the control command SET COUNTRY, a format alternative to that in the user master record can be chosen. This is stored country-specifically in table T005X.

Syntax:

/: SET COUNTRY Country key

This country key can be entered either directly in quotes or via a symbol.

Example:

/: SET COUNTRY ‘CAN’

/: SET COUNTRY &country key&

You can return to the values set in the user master record by entering an empty country name.

/: SET COUNTRY ‘ ‘

The corresponding ABAP/4 command is called internally by SAPscript, that is, this SAPscript command works in an identical way.

If the required formats are incorrect, please check the settings in table

T005X.

SET DATE MASK: Formatting of date fields

The formatting of date fields can be defined using the SAPscript command SET DATE MASK. After executing this command, all the date fields are output with this display.

Syntax:

/: SET DATE MASK = ‘date mask’

In the date mask, the following edit formats can be used:

•&#61472;DD Day (two-digit)

•&#61472;DDD Day name abbreviated

•&#61472;DDDD Day name in full

•&#61472;MM Month (two-digit)

•&#61472;MMM Month name abbreviated

•&#61472;MMMM Month name in full

•&#61472;YY Year (two-digit)

•&#61472;YYYY Year (four-digit)

All other characters in the mask are interpreted as text and copied correspondingly.

Example:

Assume that the current system date is March 1 st 1994.

/: SET DATE MASK = ‘Walldorf, DD.MM.YY’

&DATE&

Result: Walldorf, 01.03.94

/: SET DATE MASK = ‘MMMM, DD. YYYY’

&DATE&

Result: March, 01. 1994

By specifying an empty string as the date mask, you can switch back to the default display:

/: SET DATE MASK = ‘ ‘

The texts for the month and day names, shortened or in full, are stored language-dependently in table

TTDTG under the following arguments:

•&#61472;%%SAPSCRIPT_DDD_dd abbreviated day name

•&#61472;%%SAPSCRIPT_DDDD_dd full day name

•&#61472;%%SAPSCRIPT_MMM_mm abbreviated month name

•&#61472;%%SAPSCRIPT_MMMM_mm full month name

with dd: day number 01 = Monday,..., 07 = Sunday

mm: month number 01 = January,..., 12 = December

SET SIGN: Position of +/- sign

For commercial applications, it is common for a possible +/- sign of a number to be displayed to the right of the number value. In certain cases, however, it is necessary for the +/- sign to be displayed to the left of the number value. You can determine this globally with the control command SET SIGN. All program symbols which are formatted according to this command and which have a +/- sign are then displayed in the required way.

Syntax:

/: SET SIGN LEFT

The +/- sign is displayed to the left of the number.

/: SET SIGN RIGHT

The +/- sign is displayed to the right of the number.

SET TIME MASK: Formatting of time fields

You can format time fields alternatively to the standard display with the SAPscript command SET TIME MASK. After executing this command, all the time fields are output with this display.

Syntax:

/: SET TIME MASK = ‘time mask’

The following edit formats can be used in the time mask:

•&#61472;HH hours (two-digit)

•&#61472;MM minutes (two-digit)

•&#61472;SS seconds (two-digit)

All other characters in the mask are interpreted as text and printed correspondingly.

Example:

Assume that the current time is 10:08:12.

/: SET TIME MASK = ‘HH:MM’

&TIME&

Result: 10:08

/: SET TIME MASK = ‘HH hours MM minutes’

&TIME&

Result: 10 hours 08 minutes

By specifying an empty string as a time mask, you can switch back to the default display:

/: SET TIME MASK = ‘ ‘

STYLE: Change style

The control command STYLE allows you to change style within a text. This other style is used until a new

STYLE command is entered. If * is entered as a style name, you switch back to the original style.

Syntax:

/: STYLE style

/: STYLE *

The command STYLE is automatically set in the editor if another text module is inserted via the menu options Include &#61614;&#61472;&#61614;&#61472;Text and then immediately deleted. The same occurs if the contents of texts included with INCLUDE are copied into the text via Edit &#61614;&#61472;&#61614;&#61472;Selected area &#61614;&#61472;&#61614;&#61472;Delete INCLUDE.

SUMMING: Adding program symbols

Program symbols can be added with the SUMMING command. The command only needs to be defined once. Each time that the specified symbol is edited, its current value is added to the sum field. Several program symbols can also be added in a sum field.

Syntax:

/:SUMMING program symbol INTO sum symbol

As SAP script cannot define sum fields dynamically, the sum symbol must be in a structure of the calling program, which was declared with TABLES.

TOP: Set header text in window MAIN

For window MAIN, you can determine lines which are always output automatically at the top of window MAIN. These lines are also called header texts. Header texts can, for example, be used to automatically repeat the table heading at the top of every page for an extensive tabular list.

Syntax:

/: TOP

:

:

/: ENDTOP

Those text lines between the two commands are output to the top of window MAIN as of now.If you want to switch a header text off again, you enter the command pair TOP .. ENDTOP again with no lines in between:

/: TOP

/: ENDTOP

Header text does not then appear on the subsequent pages.

•&#61472;If the document window already contains text, then the header text is

only effective as of the next page.

•&#61472;The same applies to deleting a header text, that is, a header text that has

already been output can no longer be canceled on the current page.

•&#61472;You should only use header texts in texts that are not printed via

application programs, for example, dunning texts, ordering texts, and so

on. These application programs can also work with header texts via the

layout set interface, which can lead to unwanted results.

Syntax of Formatting Options

Exponent for floating point numbers

The way that a floating point number is formatted depends on whether an exponent is specified. The mantissa is adjusted by shifting the decimal point and, if necessary, introducing leading zeros, according to the exponent chosen. Using an exponent value of 0 means that the exponent representation will not be used for displaying the symbol.

Syntax:

&symbol(En)&

Example:

In this example the PLMK-SOLLWERT field is assumed to have the value 123456.78 and to be of data type

FLTP.

&PLMK-SOLLWERT& 1.23456780000000E05

&PLMK-SOLLWERT(E3)& 123.456780000000E03

&PLMK-SOLLWERT(E6)& 0.12345678000000E06

&PLMK-SOLLWERT(E0)& +123456.780000000

&PLMK-SOLLWERT(E)& +123456.780000000

Fill characters

Leading spaces in a value can be replaced with a fill character. The character immediately following the F in the specification is used as the fill character.

Syntax:

&symbol(Ff)&

Example:

The figure for customer sales in the KNA1-UMSAT field is $700. The Dictionary description of the field specifies an output length 8.

&KNA1-UMSAT& 700.00

&KNA1-UMSAT(F*)& **700.00

&KNA1-UMSAT(F0)& 00700.00

Ignoring conversion rules

SAPscript conversion routines specified in the Dictionary are automatically recognized and used when

program symbols are being formatted. These conversions can be prevented by using the K option.

Syntax:

&symbol(K)&

Leading sign to the left

The leading sign is normally displayed to the right of a numeric value, except in the case of a floating point

number. This option enables you to specify that the leading sign should be placed to the left of the number.

Syntax:

&symbol(<)&

Example:

&ITCDP-TDULPOS& 100.00-

&ITCDP-TDULPOS(<)& -100.00

The SET SIGN LEFT control command specifies that all subsequent symbols

with a numeric value should have a left-justified leading sign. Using this

control command means that there is then no need to repeat the < option for

each individual symbol.

Leading sign to the right

The default setting is to output the leading sign to the right of a numeric value. If you used the SET SIGN LEFT control command to specify that the leading sign should be output before the value, this specification can be overridden for individual symbols to enable these to be output with the leading sign to the right.

Syntax:

&symbol(>)&

You can use the SET SIGN RIGHT control command to switch back to the

default setting for the output of the leading sign.

Number of decimals

A program symbol of one of the data types DEC, QUAN and FLTP can contain decimal place data. This option is used to override the Dictionary definition for the number of decimal places for the formatting of this symbol value.

Syntax:

&symbol(.n)&

Example:

The EKPO-MENGE field contains the value 1234.56. The Dictionary definition specifies 3 decimal places and an output length of 17.

&EKPO-MENGE& 1,234.560

&EKPO-MENGE(.1)& 1,234.6

&EKPO-MENGE(.4)& 1,234.5600

&EKPO-MENGE(.0)& 1,235

Offset

Specifying an offset of n has the effect that the n left-most characters of the symbol value will not be displayed. If the offset specified is greater than the length of the value, nothing is output.

Syntax:

&symbol+n&

Example:

If symbol has the value 123456789, the following will be displayed:

&symbol& 123456789

&symbol+3& 456789

&symbol+7& 89

&symbol+12&

&symbol+0& 123456789

Omitting leading zeros

Certain symbol values are output with leading zeros . If you wish to suppress these, you may do so with the Z option.

Syntax:

&symbol(Z)&

Example:

Assuming the current date is 1/1/1994.

&DAY& 01

&DAY(Z)& 1

Omitting the leading sign

Program symbols with numeric values can have a leading sign. This sign usually appears to the right of the numeric value, either as a space for positive numbers, or as a minus sign for negative numbers. The S option can be used to ensure that the value is formatted without the sign.

Syntax:

&symbol(S)&

Example:

The ITCDP-TDULPOS field contains the value -100.00. The ABAP/4 Dictionary definition for this field includes a leading sign.

&ITCDP-TDULPOS& 100.00-

&ITCDP-TDULPOS(S)& 100.00

Omitting the separator for ‘Thousands’

Symbols of the DEC, CURR, INT and QUAN data types are normally formatted with the 'thousands' separator character. The T option allows you to specify that this separator character should be omitted.

Syntax:

&symbol(T)&

Example:

The EKPO-MENGE field contains the value 1234.56. The Data Dictionary definition specifies 3 decimal places and the output length has been set to 17.

&EKPO-MENGE& 1,234.560

&EKPO-MENGE(T)& 1234.560

Output length

If you require only a part of the symbol value , or the output has to fit into a box or a field on the screen, without overlapping the edges of this area, then you can use an output length specification to define how many character positions should be copied from the value.

If a length is specified which is greater than the current length of the value then spaces are appended to the symbol value.The character * can be used to specify the length of a program symbol. This causes the value of the symbol to be output using the output length defined in the ABAP/4 Dictionary.

Syntax:

&symbol(l)&

Example:

If symbol has the value 123456789.

&symbol(3)& 123

&symbol(7)& 1234567

An output length specification can be combined with an offset specification. The specified length is then counted from the specified offset position.

&symbol+4(3)& 567

The SYST-UNAME field contains the logon name of a user called Einstein. The Dictionary entry for this field contains an output length of 12.

&SYST-UNAME&... Einstein...

&SYST-UNAME(9)&... Einstein ...

&SYST-UNAME(*)&... Einstein ...

Preceding and subsequent text

In addition to the use of initial values for symbols, it is possible to specify additional texts which are output only when the value of the symbol is no longer the initial value. You can specify a text which is to be output immediately before the symbol value (the pre-text), and a text which is to be output immediately after it (the post-text). These texts are suppressed if the symbol has its initial value.

Syntax:

&'pre-text'symbol'post-text'&

You should ensure that the symbol, the pre-text and the post-text all appear

on a single line of the editor. This may mean that you have to use a long line

(paragraph attribute = or /= ) in the editor.

The apostrophe character ' is used as a delimiter for these texts. If this

character also appears as part of one of these texts, then it must be written

twice at this point to avoid it being interpreted as a delimiter character. A

pre-text or post-text may itself contain symbols in addition to normal text,

subject to the restriction that these symbols may not have a pre-text or a post-text.

Example:

The KNA1-PFACH field contains a customer PO Box number. Since the text "PO Box" is not stored in the

field along with the value, you would normally write the following for the PO Box line of an address:

PO Box &KNA1-PFACH&

However, if no PO Box has been specified then the result would be that the text "PO Box" would still appear on its own in the address. This can be prevented by using pre-text and/or post-text (in this case pre-text).

PO Box &KNA1-PFACH& PO Box

&'PO Box 'KNA1-PFACH&

If a PO Box has been specified, then this will be displayed together with the appropriate text in the normal way.

&'PO Box 'KNA1-PFACH& PO Box 123456

Right-justified output

Symbol values other than numeric values are normally formatted to be left-justified. Right-justified formatting can be specified with the R option. This option has to be used in conjunction with an output length specification.

Syntax:

&symbol(R)&

Example:

If symbol has the value 1234.

&symbol& 1234

&symbol(8R)& 1234

Space compression

The symbol value is viewed as a sequence of 'words', each separated from the next by either one or a string of space characters. The C option has the effect of replacing each string of space characters with a single space and shifting the 'words' to the left as necessary to close up the gaps. Leading spaces are completely removed. The results are the same as those of the ABAP command CONDENSE.

Syntax:

&symbol(C)&

Example:

Assuming ' Albert Einstein ' is the symbol value.

&symbol& Albert Einstein

&symbol(C)& Albert Einstein

Suppressing initial values

The I option can be used to suppress the output of symbols which still contain their initial value.

Syntax:

&symbol(I)&

Example:

Assuming KNA1-UMSAT contains the value 0 and the currency is USD.

&KNA1-UMSAT& 0.00

&KNA1-UMSAT(I)&

If the field contains an amount other than 0, this value will be output in the normal way.

&KNA1-UMSAT& 700.00

&KNA1-UMSAT(I)& 700.00

System Variables

&SAPSCRIPT-SUBRC&

After executing an INCLUDE statement, this contains a value that indicates whether the INCLUDE was found or not. This value can be queried with IF....

•&#61472;INCLUDE found = 0

•&#61472;INCLUDE not found = 4

&SAPSCRIPT-FORMPAGES&

This contains the total number of pages output within a SAPscript layout set (all output between the functions START_FORM and END_FORM). The state of the page counter on the individual form pages (START,HOLD,INC) is not taken into account.

Use of this symbol impairs performance, as all output data for every layout

set must be retained internally to be able to fill the symbol.

The CONDENSE option cannot be used on the program icon SAPSCRIPT-FORMPAGES

(C) without an explicit length specification: This symbol is

only replaced with a value after the form has been completely edited, as the

total number of pages of a form is first known in the program function

END_FORM or CLOSE_FORM. However, the size of the symbol (number of

characters) is reserved correctly when the symbol first occurs, with the

current page number. Therefore, only one character is reserved for option C

(CONDENSE) on pages 1-9, two characters on pages 10-99, and so on.

&SAPSCRIPT-JOBPAGES&

This contains the total number of pages output within a SAPscript print run (all output between the functions OPEN_FORM and CLOSE_FORM). The state of the page counter on the individual form pages (START,HOLD,INC) is not taken into account.

Use of this symbol impairs performance, as all output data for every print

job must be retained internally in order to fill the symbol.

&SAPSCRIPT-TELELAND&

This contains the country identifier for the fax destination with fax output via SAPscript (field ITCPO-TDTELELAND for the parameter OPTIONS of function OPEN_FORM).

&SAPSCRIPT-TELENUM&

This contains the local fax number for the fax destination with fax output via SAPscript (field ITCPO-TDTELENUM for the parameter OPTIONS of function OPEN_FORM).

&SAPSCRIPT-TELENUME&

This contains the complete fax number for the fax destination with fax output via SAPscript (field ITCPO-TDTELENUME for the parameter OPTIONS of function OPEN_FORM).

All variables of structure SYST can be used in the layout set. All these variables are called system variables.Of particular interest could be the variables for the system date and time. These can be used to indicate the date and time that the output was created. For the system date, use variable SYST-DATUM, for the system time, use SYST-UZEIT. Note that you have the formatting options for date and time variables.

Thanks & regards

Sreenivasulu P

Former Member
0 Kudos

Hi Sreenivas

thank's for that mail,but my question is quite

straight forward,why after putting the break point

on my program,why it's not switching from script

to program.i have put break point only on write_form

Former Member
0 Kudos

Hi sanju,

as i mentioned, the write_form wher u have put ur BP may not be getting executed at all during runtime.. try putting BP at a line in the program which u can be sure of reaching in runtime...like the beginning of the program itself( report statement)..

hope it helps,

Regards,

Bikash

Former Member
0 Kudos

When you are aware of the fact that the script is getting triggered, look out for the subroutine in your program which is opening the form.. put the breakpoint on 'OPEN_FORM' and also on first statement of 'Start-of-selection'.

Are you trying to debug the standard program or z program??

Former Member
0 Kudos

Hello everyone,

Im newbaby in this group and this is my first posting.

I have a very interesting question.

In the Sapscript, the equal (=) format in the tag column is supposed to get the attributes of the previous line, right? But it isn't the case with what I've been trying to work on, Because after activation, the text in the line where the equal format is at, is magically moved to the previous line. For example, let's say this previous line is a comment... so after activation, the text in the line in the equal format is moved up and continues the text in the line of comment format.

Comment: kkkkkkkkkk

Equal: lllllllllllll

After activation:

Comment: kkkkkkkkklllllllllll

So is there any Sapscript master out there?

Points are waiting for you!

Hope you can reply soon.

Because there's more weird magics in Sapscript that await you!

Miro