Skip to Content
author's profile photo Former Member
Former Member

what is PROTECT ENDPROTECT in SAPscript?

Hi SDN,

What is the significance of Protect & End-protect in Sapscripts?

Regards,

Rahul.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • Best Answer
    Posted on Dec 04, 2007 at 10:05 AM
    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 04, 2007 at 10:16 AM

    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.

    Hope dis helps

    Reward all helpful answers

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 04, 2007 at 10:07 AM

    Hi,

    Whatever is given within the PROTECT AND ENDPROTECT stmt will be displayed as a paragraph, there will be no break, provided the content fits into the space available.

    Regards,

    Vani

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 04, 2007 at 10:08 AM

    You can use PROTECT...ENDPROTECT.

    Protect & endprotect r used in scripts... to prevent page breaks..

    If you want to display the data in one page..And do not want to split the data into two pages..you will using PROTECT....ENDPROTECT..

    Here is the link, it will make u understand about protect and endprotect..

    http://help.sap.com/saphelp_47x200/helpdata/en/d1/80318f454211d189710000e8322d00/frameset.htm

    Hope this will help

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 04, 2007 at 10:14 AM

    Hi Rahul,

    The main use of PROTECT ENDPROTECT is to avoid page break.

    suppose if u r having some paragraph in ur form, if it appears at the end of page

    it may break into 2 piecs ie half paragraph will be in one page and remaining will be in the other page.

    If u use this syntax will be in page 1 or it will display in page 2, their will be no any break up in your paragraph.

    reward points if help ful.

    regards,

    desha.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.