cancel
Showing results for 
Search instead for 
Did you mean: 

protect and endprotect

Former Member
0 Kudos

if we wrote code like this what happens

protect

protect

endprotect

endprotect

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

Hi Jai,

I think....That is not a proper usage of Protect ...Endprotect....The meaning it self is clear ...is that One paragraph will come in one page and other is bigger den it will come in anothe page....If u write like That....

it will give consider the first one only....it will give error I think...

Regards,

Anil

Former Member
0 Kudos

Hi,

The protect- endprotect cannot be nested.

I think the system will not consider the inner protect- endprotect ie it will take it as a comment.

cheers

vamshi

Former Member
0 Kudos

i think it will say endprotect is missing

Former Member
0 Kudos

hi,

SAPscript provides the PROTECT .. ENDPROTECT command pair to allow you to define the areas to be protected against a page break on an individual basis. 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 output on that 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.

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

u2022 If the terminating ENDPROTECT is missing, then it will be assumed at the end of the text.

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

u2022 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 output in the normal way. It is then unavoidable that a page break will occur at some point within the text.

Former Member
0 Kudos

PROTECT

ENDPROTECT is used to keep the lines together causing a page brak if they don't fit in the same page.

So, why do you wanna code this thing that way, one PROTECT does the job.