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

internal table

Former Member
0 Likes
600

what r the control commands in sap script?

3 REPLIES 3
Read only

Former Member
0 Likes
439

hi,

I am listing some of the control commands in sap script.

Address-End Address

Bottom-Endbottom.

Box, position & size.

case-endcase

define

include

if-endif.

new-page

new-window

protect-endprotect.

set country

top-endtop.

Regards....

Arun.

Reward points if it helps.

Read only

Former Member
0 Likes
439

Hi,

Following are the control commands and their purpose.

<b>New page:</b>

You can use the NEW-PAGE command to force a page break in the text at any point you want one.

/: NEW-PAGE [page_name]

<b>PROTEC-END PROTECT:</b>

If this page protect attribute is set, then the complete paragraph is always printed on one page. This property applies only to that particular paragraph.

/: PROTECT

:

:

/: ENDPROTECT<b>

NEW-WINDOW

You</b> can use the NEW-WINDOW command to call the next main window explicitly, even if the current main window is not yet full.

<b>DEFINE.</b>

The purpose of the DEFINE command is to provide a means of making this value assignment a permanent part of the text, so that the values are available again when the text module is called again.

/: DEFINE &symbol_name& = 'value':

<b>SET DATE MASK</b>

To define the formatting of date fields, use the SET DATE MASK control command. Executing this command causes all subsequent date fields to be printed using the specified format.

Syntax:

/: SET DATE MASK = 'date_mask'

In the date mask, you can use the following codes:

DD: day (two digits)

DDD: day name - abbreviated

DDDD: day name - written out in full

MM: month (two digits)

MMM: month name - abbreviated

MMMM: month name - written out in full

YY: year (two digits)

YYYY: year (four digits)

LD: day (formatted as for the L option)

LM: month (formatted as for the L option)

LY: year (formatted as for the L option)

All other characters found in a date mask are interpreted as simple text and are copied straight into the output.

<b>SET TIME MASK.</b>

To format time fields to your needs, use the SET TIME MASK control command. Executing this command causes all subsequent time fields to be printed using the specified format.

Syntax:

/: SET TIME MASK = 'time_mask'

In the time mask, you can use the following codes:

HH hours (two digits)

MM minutes (two digits)

SS seconds (two digits)

All other characters found in a time mask are interpreted as simple text and are copied straight into the output.

<b>SET COUNTRY.</b>

The formatting for certain field types depends on the country settings. These field types include, for example, date fields and number fields that include either a decimal point or the ‘thousands’ separator character. The formatting options defined in the user master record are usually the ones used here. To choose a formatting option other than the one specified in the user master record, use the SET COUNTRY control command. The country-dependent formatting options are stored in the T005X table.

Syntax:

/: SET COUNTRY country_key

You can enter the country key either as a literal value enclosed in quotes or as a symbol.

<b>SET SIGN.</b>

The usual convention in business applications is to show the leading sign to the right of the figure to which it applies. However, it is sometimes necessary to show the leading sign to the left of the figure. To set the sign explicitly, use the SET SIGN control command. Executing this command affects the formatting of all subsequent program symbols that possess a leading sign.

Syntax:

/: SET SIGN LEFT

The leading sign appears to the left of the number.

/: SET SIGN RIGHT

The leading sign appears to the right of the numbe

<b>RESET</b>

To reset the numbering of an outline paragraph to its initial value, use the RESET control command. If you do not use the RESET command, then the numbering of all outline paragraphs in a text is continuous. If you specify the name of an outline paragraph in the RESET command, then its paragraph numbering and that of subordinate paragraphs is reinitialized.

Syntax:

/: RESET paragraph_format

The paragraph format specifies the outline paragraph to be reset

<b>INCLUDE</b>

To include the contents of another text into the current text, use the INCLUDE control command.

Syntax:

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

[NEW-PARAGRAPH np]

<b>STYLE</b>

The STYLE control command allows you to change the style within a text. The new style is in force until another STYLE command is issued. If you specify * as the name of the style, then the system reverts to the default paragraph of the original style or form.

Syntax:

/: STYLE style [DOMINANT]

/: STYLE *

A style set with this command has no effect in a text included with INCLUDE. The system takes the paragraph and character formats from the calling text. To use the style set with STYLE in the INCLUDE text as well, you must add DOMINANT to the command.

<b>ADDRESS.</b>

The ADDRESS - ENDADDRESS control command formats an address according to the postal convention of the recipient country defined in the COUNTRY parameter. The reference fields are described in the structures ADRS1, ADRS2, or ADRS3, depending on the type of address. Either direct values or symbols may be assigned to the parameters.

Syntax:

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

/: TITLE title

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

/: PERSON name of natural person [TITLE form of address]

/: PERSONNUMBER number of the personen

/: DEPARTMENT department

/: STREET street name HOUSE house number

/: LOCATION additional location information

/: POBOX po box [CODE post code / zip code] [CITY city]

/: POSTCODE post code / zip_code

/: CITY city1[,city2]

/: NO_UPPERCASE_FOR_CITY

/: REGION county / state

/: COUNTRY recipient country [LANGUAGE language code]

/: COUNTRY_IN_REC_LANG

/: LANG_FOR_COUNTRY language key

/: FROMCOUNTRY sender country

/: ADDRESSNUMBER address number

/: ENDADDRESS

The parameter values contain both formatting and address information. The address data are formatted for output according to the data in the following parameters:

TYPE

FROMCOUNTRY

COUNTRY

LANGUAGE

PRIORITY

DELIVERY

LINES

For more information, see the documentation for the SAP function module ADDRESS_INTO_PRINTFORM.

If DELIVERY is not specified and if a POBOX is specified, then the POBOX is used in an address instead of a STREET.

Parameters

DELIVERY

Means that the address should be formatted as a complete delivery address, using the street name and number rather than the P.O. Box.

TYPE

Specifies the type of address. The following types are possible:

Normal address (ADRS1). This is the address of a company or organization. It corresponds to the address structure that is expected in most SAP applications.

Private or personal address (ADRS2). This is the address of a natural person, a private or home address.

Company addressDienstadresse (ADRS3) with contact person. This is the address of a colleague or contact within a company or organization. The company name should be specified in the TITLE and NAME fields; the ATTN: contact person should be named in PERSON and TITLE.

Should you enter another address type or leave the field blank, then type 1 is used for formatting.

PARAGRAPH

Specifies the paragraph format to be used for outputting the address. If this parameter is not given, the address will be output using the default paragraph format.

PRIORITY

Specifies which of the address lines may be omitted should this be necessary. Any combination of the following codes may be specified. The order in which you list the codes determines the order in which address lines are left out.

The codes are as follows:

A Title

P Mandatory empty line

4 Name4

3 Name3

R Region

T Neighborhood, administrative section of a city (CITY2)l

D Department

L Country name

C Post code or zip code

2 Name2

B P.O. Box (Japan only)

S Street name and number or P.O. Box, depending upon DELIVERY parameter

N Name and form of address of natural person (PERSON and TITLE)

I Location information in LOCATION

O City

LINES

Specifies how many lines may be used for formatting the address. If there are too few lines available to allow all the address data to be formatted, then the data specified in the PRIORITY parameter are omitted. If there is no LINES parameter and if this command is in a form window of a type other than MAIN, then the number of lines available for formatting the address are automatically calculated based on the current output position and the size of the window.

TITLE

Title or form of address. Used only with addresses of types 1 and 3.

NAME

Up to four names may be given, separated by commas. Used only with addresses of types 1 and 3.

PERSON

Name of the addressee. Used only for addresses of type 2 (private or personal address) or type 3 (company contact address). In type 3 addresses, use PERSON for the name of your contact person: ‘Attn: Mr. Jeffries’. The name fields should be used for the company address.

PERSONNUMBER

Personal number. Can be used only for address types 2 or 3 (private or personal address).

TITLE (with PERSON)

Title of the addressee. Can be used only for address types 2 or type 3 (private or personal address).

DEPARTMENT

Department of the addressee. Can be used only for address type 3 (company address).

STREET

Street name.

HOUSE

House number for the corresponding street.

LOCATION

Additional location information, such as the building, "Upstairs Apartment" and so on. Appears on its own line in the address.

POBOX

P. O. Box

CODE

The post code / zip code of the P. O. Box if this differs from the post code / zip code of the recipient.

CITY

The city in which the destination P.O. Box is located if this differs from the city of the recipient.

POSTCODE

Post code / zip code of the recipient.

CITY

Addressee’s city. city1 is expected to be the city; city2 is the neighborhood or administrative section, if required.

NO_UPPERCASE_FOR_CITY

Default = NO_UPPERCASE_FOR_CITY ‘ ‘

Usually, the system prints the city and country names of foreign addresses in uppercase ( NO_UPPERCASE_FOR_CITY ‘ ‘ ).

You can use this parameter to force the system to output city and country name unchanged (uppercase/lowercase).

( NO_UPPERCASE_FOR_CITY ‘X’ )

REGION

This allows an administrative region, county, province, or state etc. to be specified.

COUNTRY

Specifies the recipient country, i.e. the country according to whose postal conventions the address is to be formatted.

COUNTRY_IN_REC_LANG

This flag tells the system to use the recipient language for the country name.

( COUNTRY_IN_REC_LANG ‘X‘ )

( Default: Recipient language is not used: COUNTRY_IN_REC_LANG ‘ ‘ )

LANG_FOR_COUNTRY

Default = Space

Use this parameter to explicitly set the language in which to print the country name of a foreign address. By default, the system uses the language of the sending country.

LANGUAGE

Language code of the language of the recipient country, if it differs from that of the recipient COUNTRY. Example: addresses in Switzerland. Standard SAP language codes are used; you can display these in the initial SAPscript text processing screen or in table T002.

FROMCOUNTRY

Specifies the language to be used for formatting the name of the recipient country. For most European countries, the recipient country is specified by placing the international car registration letters in front of the post code and separating them from the post code with a hyphen. You must always specify the sender country.

ADDRESSNUMBER

The number is used to index a central address file, from which the desired address is read instead of using the set of the above fields. You can find more information on this facility in the documentation for the function module ADDRESS_INTO_PRINTFORM.

<b>TOP</b>

You can use the TOP.. ENDTOP control command to specify lines of text that you want to print always at the top of the main window. These text lines are also known as header texts. For example, you would use header texts in the case of a very long table covering several pages of output 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, such as reminder texts, order texts. These applications programs can also work with header texts via the form interface, which may lead to unexpected results.

<b>BOTTOM</b>

You can specify footer texts for the main window in a similar way to header texts. Footer texts are always printed 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 printed on the current page.

Footer texts should not be employed in texts that are printed from applications programs, such as reminder texts, order texts. These applications programs can also work with footer texts via the form interface, which may lead to unexpected results.

<b>

IF-ELSE</b>

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

Syntax:

/: IF condition

:

:

/: ENDIF

The logical expression can use the following comparison operators:

= EQ equal to

< LT less than

> GT greater than

<= LE less than or equal to

>= GE greater than or equal to

<> NE not equal to

The following logical 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, that is, the symbols are formatted as character strings before they are compared. 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 (a period or a comma) depending on the applicable currency key.

You can extend the IF command with the ELSE command to allow text lines to be specified that you want to print in case the condition is false. If the condition is true, the text lines enclosed by the IF and ELSE commands are formatted; otherwise the text lines enclosed by the ELSE and ENDIF commands are formatted.

Syntax:

/: IF condition

:

/: ELSE

:

/: ENDIF

The ELSEIF command allows you to specify multiple cases.

Syntax:

/: IF condition

:

/: ELSEIF condition

:

/: ELSE

:

/: ENDIF

You can use any number of ELSEIF commands within one compound IF.. ENDIF control command. The use of an ELSE command is then optional.

You must not extend a condition over more than one line. Both the IF or ELSEIF command and the attached condition must be completely contained within a single line.

You can nest IF commands.

You must terminate an IF command with an ENDIF command. If you forget this, there will be no more output following the IF command if the condition is false.

If a syntax error occurs in the interpretation of this command, then the command is not 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 printed.

<b>CASE</b>

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 found in one of the WHEN lines, then the text lines following this WHEN line are printed. If no matching value is found then the text lines enclosed by the WHEN OTHERS line and the ENDCASE command are printed. The WHEN OTHERS section is optional.

As with 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.

<b>PERFORM</b>

You can use the PERFORM command to call an ABAP subroutine (form) from any program, subject to the normal ABAP runtime authorization checking. You can use such calls to subroutines for carrying out calculations, for obtaining data from the database that is needed at display or print time, for formatting 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.

The system does not execute the PERFORM command within SAPscript replace modules, such as TEXT_SYMBOL_REPLACE or TEXT_INCLUDE_REPLACE. The replace modules can only replace symbol values or resolve include texts, but not interpret SAPscript control commands.

Syntax in a form window:

/: PERFORM <form> IN PROGRAM <prog>

/: 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 ABAP subroutine called via the command line stated above must be defined in the ABAP report prog as follows:

FORM <form> TABLES IN_TAB STRUCTURE ITCSY

OUT_TAB STRUCTURE ITCSY.

...

ENDFORM.

The values of the SAPscript symbols passed with /: USING... are now stored in the internal table IN_TAB . Note that the system passes the values as character string to the subroutine, since the field Feld VALUE in structure ITCSY has the domain TDSYMVALUE (CHAR 80). See the example below on how to access the variables.

The internal table OUT_TAB contains names and values of the CHANGING parameters in the PERFORM statement. These parameters are local text symbols,

<b>PRINT-CONTROL</b>

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 spool maintenance transaction SPAD that contains the printer commands you want. You can then 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 print control printed via PRINT-CONTROL should always be a print control created in the customer name area (Zxxx) for the device type used. Use no Sxxx print controls, since their contents may be changed by SAP at any time with a release or driver modification. To modify SAP device types, refer to Note 3166.

The printer commands in the print control must never effect the current printer settings, since the SAPscript printer driver has no information on any changes triggered by a print control, which would have to be undone by commands of the driver itself. The printer driver assumes that the print control has no effect on any texts or graphics printed afterwards.

Never use PRINT-CONTROL to control print attributes covered by the SAPscript driver. To change such print attributes, use the usual method of defining form and style and the device type accordingly.

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 first try 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 (for example, 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, you should give this text line the '=' paragraph format

<b>BOX,POSITION AND 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:

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

<b>HEX ENDHEX</b>

Use this command 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 (for example, 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 of 0 to 255. The characters 0 to 9 and A to F for representing the values 10 to 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]

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 printed. 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 printed below this point. If the LEFT parameter is also specified, then the output of the hexadecimal data will is indented from the left margin by the specified amount.

<b>SUMMING</b>

The SUMMING command is used for accumulating a total value for a program symbol. The command should be specified just once. Then, each time the specified program symbol is formatted, its current value is added into the total symbol. Several program symbols may all be added into a single total symbol.

Syntax:

/: SUMMING program_symbol INTO total_symbol

SAPscript cannot create the field for the total dynamically. The summing symbol used for totalling must be declared with TABLES in the ABAP program. Otherwise, only zero is added. Declaring the symbol with the DATA statement is not sufficient (global data).

<b>Award points if it helps you and close the thread.</b>

Br,

Laxmi.

Read only

Former Member
0 Likes
439

hi,

Full sap scripts details has been given by Laxmi.Suryadevara.So please close the thread.

sri