cancel
Showing results for 
Search instead for 
Did you mean: 

Scripts

Former Member
0 Kudos

Hi All Good Morning..

In scripts how many commands (like Protect) are there and explain with brief explanation?

Please Send me your valuable suggestion to me.

Thanks & Regards.

Satish.K

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos
Shivaji16
Active Participant
0 Kudos

Hi,

SAPscript Control Commands

The functionality of the SAPscript editor is made available through a set of commands. These commands give you full editing control over your text. They are executed immediately when called.

There is, however, another kind of SAPscript command, namely the control commands. The purpose of these is to allow control of the output formatting. These commands are not interpreted by the SAPscript editor, but are passed through to the SAPscript Composer for processing. The Composer is the program that converts text from the form displayed in the editor to the form used for printing. This includes, for example, line and page formatting, the replacement of symbols with their current values and the formatting of text according to the paragraph and character formats specified.

The SAPscript control commands are described in the following sections.

Syntax of Control Commands

Explicit Page Break: NEW-PAGE

Preventing Page Breaks: PROTECT

Next Main Window: NEW-WINDOW

Assigning a Value to a Text Symbol: DEFINE

Formatting Date Fields: SET DATE MASK

Formatting Time Fields: SET TIME MASK

Country-Dependent Formatting: SET COUNTRY

Position of the Leading Sign: SET SIGN

Initializing Numbered Paragraphs: RESET

Including Other Texts: INCLUDE

Changing the Style: STYLE

Formatting Addresses: ADDRESS

Setting a Header Text in the Main Window: TOP

Setting a Footer Text in the Main Window: BOTTOM

Conditional Text: IF

Finding a Match: CASE

Calling ABAP Subroutines: PERFORM

Inserting Print Controls: PRINT-CONTROL

Boxes, Lines, Shading: BOX, POSITION, SIZE

Hexadecimal Data: HEX, ENDHEX

Summing a Program Symbol: SUMMING

Shivaji16
Active Participant
0 Kudos

Hi,

Preventing Page Breaks: PROTECT

You can specify, either in the style or in the form, that a particular paragraph should not be split in two by a page break. 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.

This attribute is not intended to be used to protect all paragraphs against a page break. The point is that a page break is by its very nature a dynamic event and the exact point at which it occurs depends on the current state (length and contents) of the preceding text. It is also possible that you may want to protect only certain parts of a paragraph against a page break. One way to achieve this is to use the NEW-PAGE command immediately before the text concerned starts. Explicitly beginning a new page at this point should ensure that a further page break does not occur within the text. However, this technique is not change-friendly. For example, you format your text with the help of the NEW-PAGE command so that no page breaks occur where they should not. At a later time, you insert or delete some lines. These changes cause all the subsequent text to be moved relative to the printed page, and you must check each NEW-PAGE command you previously inserted to see if it is still in the correct place.

To allow you to define the areas to be protected against a page break on an individual basis, SAPscript provides the PROTECT.. ENDPROTECT command pair. If you enclose the text to be protected in these commands, then SAPscript will ensure that each line of this text is printed together on the same page. If the complete text fits in the space remaining on the current page, then it is printed on this page just as it would be if no PROTECT command had been used. If, however, the remaining space is not sufficient for the text, then the PROTECT command has the same effect as a NEW-PAGE command and text is printed on a new page.

Thus the PROTECT/ENDPROTECT commands may be regarded as a kind of conditional NEW-PAGE command, the condition being whether or not the lines enclosed between the two commands fit in the space remaining in the current main window.

Syntax:

/: PROTECT

:

:

/: ENDPROTECT

The text lines to be protected are enclosed between the two commands.

An ENDPROTECT command without a preceding PROTECT command has no effect.

If the terminating ENDPROTECT is missing, SAPscript assumes it at the end of the text.

PROTECT.. ENDPROTECT command pairs cannot be nested. If a second PROTECT command occurs before the first one has been terminated by an ENDPROTECT, it is ignored.

If the text enclosed by a PROTECT.. ENDPROTECT pair is itself too long for a single page, then a page break is generated immediately before the text and the text is printed in the normal way. It is then unavoidable that a page break will occur at some point within the text.