Friday 14 November 2014

SCRIPT : How PROTECT - ENDPROTECT works in SAP SCRIPT?


PROTECT ... ENDPROTECT - is used to enclose the text in order to prevent the PAGE Break. It allows us to define areas to be protected against page break . 
Syntax:
/:PROTECT
* LINE TEXT TO BE DISPLAYED TOGETHER
/: ENDPROTECT

-------------------------------------------------------------------------------------

Step1. Add a MAIN window instance 00 to the Page Window. here mark that we have specific height of the main window. Select the button as highlighted to maintain of text element.













Step2. Here maintain some Paragraph lines under the text element : TXT_ELEM_1. Go back and activate the text element.
























Step3. Execute the report.

























Step4. So the output are span over 2 pages.






















Step5. Our goal is to put some piece of paragraph lines into a single page. So put those lines of paragraph in between PROTECT & ENDPROTECT command. Go back & activate the form.






































Step6. Execute the program.

























Step7. So here we  got the output in a single page due to the effect of PROTECT & ENDPROTECT.




























Step8. Again go back to the text element of the MAIN window and maintain some more lines & remove the PROTECT & ENDPROTECT command. Go back and activate it.






































Step9. Run the program that calls our above script.

























Step10. So again the output text is displayed in two different pages.

























Step11. Again go back to the SCRIPT main window and provide the PROTECT & ENDPROTECT COMMAND. Go back and activate it.






































Step12. Run the program.

























Step13. So here is the output. It is displayed in two different pages but the lines that are in between PROTECT & ENDPROTECT is displayed in only a single page. In this case as it is unable to put all in the page 00001 because already it contains a previous line 'This is the starting line.' , so the line text in between PROTECT & ENDPROTECT  are displayed all in one as a single paragraph in the second page. But if the line content between PROECT & ENDPROTECT are large enough which can not be accommodated in a single page due to height constraint, then there would be no effect of 
PROTECT & ENDPROTECT.



















----------------------------------------------------------------------------------------------

No comments:

Comments system

Disqus Shortname