Usage of protect endprotect in smartforms

To control the Paragraph in a page we use protect endprotect in SAP SCRIPT. how to go about it in smartorms

Syntax:
/: PROTECT
/: ENDPROTECT
The lines to be protected lie between the two commands.
An ENDPROTECT command without a preceding PROTECT command is ineffective.
If the last ENDPROTECT is missing, it is implicitly assumed at the end of the text.
PROTECT .. ENDPROTECT commands cannot be nested. If a second PROTECT command is recognized while another is active, the second is ignored.
If the text between PROTECT and ENDPROTECT is so extensive that it would not fit on an empty page, then only one form feed is generated and the text is normally output. Thus, in this case, the section to be protected is separated by a page break.

Similar Messages

  • Protect - endprotect in Smartform

    hi
    what is the similar statement for protect-endprotect in smartforms
    please help me out.
    regards
    padma

    HI
    here are two options for protection against line break:
    - You can protect a line type against page break.
    - You can protect several table lines against page break for output in the main area.
    Protection against page break for line types
    - Double-click on your table node and choose the Table tab page.
    - Switch to the detail view by choosing the Details pushbutton.
    - Set the Protection against page break checkbox in the table for the relevant line type.  Table lines that use this line type are output on one page.
    Protection against page break for several table lines
    - Expand the main area of your table node in the navigation tree.
    - Insert a file node for the table lines to be protected in the main area.
    - If you have already created table lines in the main area, you can put the lines that you want to protect again page break under the file using Drag&Drop. Otherwise, create the table lines as subnodes of the file.
    - Choose the Output Options tab page of the file node and set the Page Protection option.   All table lines that are in the file with the Page Protection option set are output on one page.
    In 4.6, Alternatively in a paragraph format use the Page protection attribute to determine whether or not to display a paragraph completely on one page. Mark it if you want to avoid that a paragraph is split up by a page break. If on the current page (only in the main window) there is not enough space left for the paragraph, the entire paragraph appears on the next page. 
    Regards
    PAVAN

  • How to write Protect endprotect concept in Smartforms

    hi
    can any one suggest me
    How to write Protect endprotect concept in Smartforms
    i have some content to coem without break in SMARTFORM
    how to do that
    Thanks & Regards
    kalyan
    <thread moved, has nothing to do with ABAP Objects. Please choose your forums more carefully in future>
    Edited by: Mike Pokraka on Sep 26, 2008 12:50 AM

    Hi,
    For 4.7 version if you are using tables, there are two options for protection against line break: 
    - You can protect a line type against page break.
    - You can protect several table lines against page break for output in the main area.
    Protection against page break for line types 
    - Double-click on your table node and choose the Table tab page. 
    - Switch to the detail view by choosing the Details pushbutton. 
    - Set the Protection against page break checkbox in the table for the relevant line type.  Table lines that use this line type are output on one page. 
    Protection against page break for several table lines 
    - Expand the main area of your table node in the navigation tree. 
    - Insert a file node for the table lines to be protected in the main area. 
    - If you have already created table lines in the main area, you can put the lines that you want to protect again page break under the file using Drag&Drop. Otherwise, create the table lines as subnodes of the file. 
    - Choose the Output Options tab page of the file node and set the Page Protection option.   All table lines that are in the file with the Page Protection option set are output on one page. 
    In 4.6, Alternatively in a paragraph format use the Page protection attribute to determine whether or not to display a paragraph completely on one page. Mark it if you want to avoid that a paragraph is split up by a page break. If on the current page (only in the main window) there is not enough space left for the paragraph, the entire paragraph appears on the next page. 
    Regards,
    Himanshu Verma

  • PROTECT-ENDPROTECT problem in SAP Script

    In SAP Script MAIN Window I have 10 different elements to print differet stuff related with each delivery line item.
    Like Material Number
    Material Description
    Long text [Has formatted text and I am reading that text and printed in some format some lines under material number and some under materail desc.]
    and other information required by client.
    Loop at Delivery item table.
    CALL FUNCTION 'CONTROL_FORM'
           EXPORTING
                command = 'PROTECT'.
    Print differnt elements.
    Loop at lond text internal table.
    print in proper format as I mentioned.
    endloop.
      CALL FUNCTION 'CONTROL_FORM'
           EXPORTING
                command = 'ENDPROTECT'.
    ENDLOOP.
    My problem is PROTECT ENDPROTECT is not working properly.
    It is printing only 1 item with other info on first page as there are enough space left to print minimum three items with details.
    on next page it is priting only 3-4 items as there are enough sapce to ptint at lease 10 items with details.
    The only good thing is it is not spliting the Item details and other text.[Main window on next page has bigger size]
    Any idea why PROTECT - ENDPOTECT not behaving properly.
    Thanks
    Aman
    Message was edited by: Amandeep  Singh

    Hello,
    Try to do like, Put PROTECT and ENDPROTECT in the SAPScript itself.
    Like
    Element 1
    Protect
    ..matnr....
    element 2
    ...desc....
    element 3 (long text)
    ...text
    ....text
    element 4
    endprotect
    call the element 4 in the loop statment, whenever required.
    Hope it will work.
    Regards,
    Naimesh.

  • Protect-Endprotect Command

    Hoz exactly we use Protect-EndProtect command to avoide output text which should not spilt in two pages. Plz explain with example of Codes.
    Thanks.

    Hi
    It is used to protect the address or info to print in one page only
    If the space in one page is not sufficient it will print in the second page
    see the sample
    /:           PROTECT
    /:           ADDRESS PARAGRAPH AS
    /:             TITLE    &LFA1-ANRED&
    /:      NAME     &LFA1-NAME1&, &LFA1-NAME2&, &LFA1-NAME3&,
    /:             STREET   &LFA1-STRAS&
    /:             POBOX    &LFA1-PFACH&  CODE &LFA1-PSTL2&
    /:             CITY     &LFA1-ORT01&, &LFA1-ORT02&
    /:             POSTCODE &LFA1-PSTLZ&
    /:             COUNTRY  &LFA1-LAND1&
    /:             REGION   &LFA1-REGIO&
    /:             FROMCOUNTRY &T001-LAND1&
    /:           ENDADDRESS
    /:       ENDPROTECT
    Reward points if useful
    Regards
    Anji

  • PROTECT-ENDPROTECT IN SAP SCRIPT

    HOW DO WE USE PROTECT-ENDPROTECT TO MAKE SURE THAT THE OUTPUT DISPLAYED IN A VARIABLE WINDOW IS EITHER COMPLETE OR NOT PRINTED AT ALL.

    Check this Documentation,
    I have this full document if you want i will mail you..
    <b>PROTECT: Protect from page break</b>
    You can determine that a paragraph must not be separated by a page break in the style or layout set. If the attribute page protection is set, then all the lines of this paragraph are always output together on one page. This attribute is linked to the respective paragraph.
    It certainly does not make sense, to provide all the paragraphs with a page protection attribute to neutralize an unwanted page break. This event is much too dynamic for this and only results from the current text. Furthermore, it can also happen that you only want to protect parts of a paragraph from a page break. In principle, you could solve this problem using the command NEW-PAGE, by explicitly starting a new page before the affected parts of the text. However, this procedure is not very easy to make changes to. Assume that you have formatted your text using the NEW-PAGE command so that you have no unwanted
    page breaks. If you now insert new lines or delete existing ones, you would have to check all the NEW-PAGE commands inserted after this point in the text, as changes can result in the movement of page breaks. With the command pair PROTECT. ENDPROTECT, SAPscript offers you the option of individually defining protection from a page break. If you parenthesize the text in question using these commands, SAPscript automatically guarantees that all the lines it contains are printed together on one page. If the lines fit on the current output page, they are output there, in exactly the same way as if the PROTECT
    command was not used. If, however, the space is not sufficient, the PROTECT command then works as a NEW-PAGE and generates a form feed .For this reason, you can view PROTECT/ENDPROTECT as a conditional NEW-PAGE command, whose condition consists of whether the included lines fit into the current window MAIN or not.

  • What is PROTECT ENDPROTECT in SAPscript?

    Hi SDN,
    What is the significance of Protect & End-protect in Sapscripts?
    Regards,
    Rahul.

    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

  • Override Use of Protect-Endprotect Function when editing Standard Sapscript

    Hi abapers,
    I have made a copy of a standard form (F150_DUNN_01) and edited it according to the customers needs.  One problem I have encountered is the use of seperate elements, As you can see in the standard form, the table is output as one element and the total appears afterwards in another element.  As I am not editing the print control program I have added texts, etc. after the totals line but inside elements which I know are always output.  I have recently noticed that some of the elements are protected using the 'CONTROL_FORM' function in the print control program.
    This leads me to the problem, when I have between 10-15 records in the table the following elements (540 - 592) are printed on the following page.  I have read about the protect-endprotect statements but in my case it would be between 2 elements.
    I would like the totals line to appear along with the table and the rest can go on the next page.   Is it possible to use this method without editing the print control prorgam to call elements without protection?  Elements 581 - 592 are currently protected using the 'CONTROL_FORM' function in the print program.
    Here is a snippet of the MAIN window with some PROTECT statements used but not working as expected.
    /:           PROTECT
    /E           530
    T3            <BU>INV.NUM</>,,<BU>DATE</>,,<BU>INV.Amount</>,,<BU>DUE DATE</>,,
    =           <BU>NOTE</>
    T3                                                                                  
    /E           531
    /:           DEFINE &TDLINE& = ''
    /:           PERFORM GET_TEXT IN PROGRAM ZFII_F150_ROUTINE
    /:           USING &T001-SPRAS&
    /:           USING &MHND-BELNR&
    /:           USING &MHND-BUKRS&
    /:           USING &MHND-GJAHR&
    /:           CHANGING &TDLINE&
    /:           ENDPERFORM
    T3            &MHND-BELNR&,,&MHND-BLDAT&,,&MHND-WRSHB(C)&,,&MHND-FAEDT& ,,&TDLINE&
    /E           540
    /E           550
    AS           Inicio:      &T040A-TEXT1&
    /E           551
    AS           Fin:          &T040A-TEXT1&
    /E           570
    T3           Gtos.reclam.,,&F150D-WAERF&,,&F150D-MHNGF(C)&
    /E           581
    T3           ,,,,&ULINE(15)&
    T3           ,,&F150D-WAERF&,,&F150D-SUFPF(C)&
    /E           582
    T3           ,,&F150D-WAERF&,,&F150D-SUFPF(C)&
    /:           ENDPROTECT
    /E           591
    AS                                                                                  
    /:           CASE &MHNK-MAHNS&
    /:           WHEN '1'
    /:           INCLUDE ZFI_DUNN_MAIN5911 OBJECT TEXT ID ST LANGUAGE &T001-SPRAS&
    /:           WHEN '2'
    /:           INCLUDE ZFI_DUNN_MAIN5912 OBJECT TEXT ID ST LANGUAGE &T001-SPRAS&
    /:           WHEN '3'
    /:           INCLUDE ZFI_DUNN_MAIN5913 OBJECT TEXT ID ST LANGUAGE &T001-SPRAS&
    /:           ENDCASE
    T6                                                                                  
    /E           592
    T6                              ,,&F150D-WAERF&,,&F150D-SALFW(C)&
    Regards,
    Simon
    Edited by: Simon Kerr on Oct 4, 2010 12:14 PM

    Hi Vijay,
    Thanks for reply but it isn't work.
    I think there is no documentaion available in any languagein the SAP.
    So If possible give me any other reference by which I can search documentation.
    Or just check it at your end if available send it to me.
    Please try once again.
    I wnat documentation for function modules in the Function Group MBWL & J1IEXGM.
    both are used for MIGO.
    Thanks and Regards
    Dhanu

  • Example using command protect & endprotect

    hii gem's
    im unable to find the difference when using protect...endprotect
    without tht bcoz im getting same output
    ex:
    /: protect
    PH  'THIS IS TEST'
    PH  'THIS IS TEST'
    /: NEW-PAGE
    PH 'THIS IS TEST'
    ENDPROTECT
    please give a example using command protect & endprotect
    THANK U
    REWARDS FOR GUD REPLY
    REGARDS
    JAIPAL

    Hi Jaipal,
    It is mainly used to prevent the page break
    menas whatever lines you wrote between these protect and endprotect they are always printed in a single page only and they won't split into two pages though there is no full space
    go to SE71 see any scripts pagewindows
    you will find a lot of examples
    /E           TOTAL_AMOUNT
    /:           PROTECT
    UL           &ULINE(71)&
    TO                                                                                  
    TO           ,,Total net value excl. tax &EKKO-WAERS&,,
                                        &KOMK- FKWRT&
    /:           IF &SUM-EURO-PRICE& NE '                0,00'
    /           ,,                          EURO,,&SUM-EURO-PRICE&
    /:           ENDIF
    /:           ENDPROTECT
    Reward points for useful Answers
    Regards
    Anji

  • Protect functionality in Smartform

    Hi,
    Do we have any command like Protect in smartform to keep the contents of a page together.
    Also i have decalred an internal tabe in which some fields are coming from VBAK and other from VBAP, now when i am trying to declare it in Smartform interface i am getting an syntax error "table not defined in dictinory".
    Thanks in advance.
    Gurjeet

    Hi,
    For Page Protection in smartforms, take a look at SAP Note 382366. Additionally, look at following posts on SAP Fans:
    1. http://www.sapfans.com/forums/viewtopic.php?t=7100
    2. http://www.sapfans.com/forums/viewtopic.php?t=10393
    Hope this helps.
    Regards

  • PROTECT ENDPROTECT doesen't work sapscript

    hello,
    i would like to use protect becuase i want that this element stays in one entire page, but he continue to broke the element.... why?
    i use protect and endprotect...it's correct?
    /E           ITEM_LINE
    /:           PROTECT
    /:           SET DATE MASK = 'DD/MM/YY'
    /*           IF &PAGE(C)& <> 1
    /*           &ULINE(112)&
    /*           ENDIF.
    T2           &VBDPA-POSNR(Z)&,,&VBDPA-MATNR(C)&,,&VBDPA-MEINS(Z)&
    =           ,,&VBDPA-KWMENG(C)&,,&VBEP-EDATU&,,&T_PRICES-PR_LORDO(C)&,,
    =           &T_PRICES-PR_SCONTO(C)&
    /*           PERFORM GET_PRICING IN PROGRAM ZRVADOR01_FRM.
    /*           USING &VBDKA-VBELN&
    /*           ENDPERFORM.
    T2           ,,&VBDPA-ARKTX&
    /*           ,,&'Numero articolo cliente 'VBDPA-IDNKD' '&&'Posizione 'VBDPA-POSEX&
    /*           ,,&'Partita 'VBDPA-CHARG&
    /:           ENDPROTECT

    Try this,
    I think there is a small error in your code.
    /E ITEM_LINE
    /: PROTECT
    /: SET DATE MASK = 'DD/MM/YY'
    /* IF &PAGE(C)& 1
    Instead try this
    /* IF &PAGE(C)& = 1
    /* &ULINE(112)&
    /* ENDIF.
    T2 &VBDPA-POSNR(Z)&,,&VBDPA-MATNR(C)&,,&VBDPA-MEINS(Z)&
    = ,,&VBDPA-KWMENG(C)&,,&VBEP-EDATU&,,&T_PRICES-PR_LORDO(C)&,,
    = &T_PRICES-PR_SCONTO(C)&
    /* PERFORM GET_PRICING IN PROGRAM ZRVADOR01_FRM.
    /* USING &VBDKA-VBELN&
    /* ENDPERFORM.
    T2 ,,&VBDPA-ARKTX&
    /* ,,&'Numero articolo cliente 'VBDPA-IDNKD' '&&'Posizione 'VBDPA-POSEX&
    /* ,,&'Partita 'VBDPA-CHARG&
    /: ENDPROTECT

  • Page protection in the smartform

    Hi All,
    I am working with an issue in smart forms.
    Requirement: The main table header in the main window should be dispalyed from the second page if and only if there is no space for atleast single item level in the first page.
    Solution that i tried for: I have created a folder under the header of main table and added all the  table lines which were present in the header and checked the page protection  tab.
    The impact to the solution is that it is working but in the second page i am getting 2 headers
    example :
    header
    lineitem1 value
    lineitem2 value
    header
    Querry:I dont want to display the header which is at the bottom.Is that possible?If possible i would like to take help .
    Thanks in advance,
    Bhavani.

    Click on the 'Header' node of the table. Under the 'output option' tab, there are two check boxes 'At start of the table' and 'At page break'. check and uncheck them as you want to display the table header and check the output.
    and there is no need of creating any folder under header node.
    Hope it will help you
    Edited by: Sujeet Karn on Oct 30, 2009 3:40 PM

  • Protect -Endprotect functionality in reports

    Hi ,
    As per my user requirement like this.
    final intarnal table having value like this.
    EX:
    field1  field2
    1        1000
    1        2000
    2       1000
    2       3000
    3    10000
    3     2000
    3      5000
    4      1000
    4      2970
    4      5000
    5      4000
    5      6000
    In output first page it is displaying
    1        1000
    1        2000
    2       1000
    2       3000
    3    10000
    3     2000
    3      5000
    4     1000
    and some footer data
    in next page ( page 2 )
    4      2970
    4      5000
    5      4000
    5      6000
    they need like all at one place like Protect functinality in script.
    Please advise on this.
    Regards
    salini

    Hi Salini,
                For this Increase the length of the page.  See below.
    Determining the Page Length  
    To determine the page length of an output list, use the LINE-COUNTaddition of the REPORT statement.
    Syntax
    REPORT rep LINE-COUNT length[(n)].
    This statement determines the page length of the output list of program rep as length lines. If you specify the optional number n, the system reserves n lines of the page length for the page footer. Those lines of the page footer that are not filled at the END-OF-PAGE event, appear as blank lines (see Defining a Page Footer).
    If you set length to zero, the system uses the standard page length (see The Standard List). To adapt the page length to the current window size, see Lists with Several Pages. While the list is created, the system field SY-LINCT contains the current number of lines per page (that is length, or 0 for the standard page length).
    Consider that the length of the page header is part of length. Thus, for the list itself you can use only length minus page header length minus n lines. If length is less than the page header length, a runtime error occurs.
    If during list processing the system reaches the end of the area provided for the actual list, it outputs the page footer, if any, inserts some space, and starts a new page. The space inserted belongs to the list background and is not a line of the list. The sy-pagno system field always contains the current page number.
    Regards,
    Md Ziauddin

  • Usage of command node in smartforms

    Hi
    my doubt is can I branch to multiple pages using command node in smart forms.if so how to do it.

    Hi,
    Please check with the following threads
    [Command node|Re: Smartforms: Option of Printing Specific Pages Only;
    [Document on command node|http://www.sdn.sap.com/irj/scn/index;jsessionid=(J2EE3417200)ID0250336250DB00400831958585035375End?rid=/library/uuid/a01b2c4d-711f-2b10-3eb2-abe3464bb370&overridelayout=true]
    Hope this  helps you.
    Regards,
    Rajani

  • PROTECT in SMARTFORMS

    Hi,
    in sapscript we have sentence PROTECT/ENDPROTECT,
    what is the equivalent in smartforms?
    How can i do likewise in smartforms?
    Best regards.

    Hi
    Yes you can use it in the table node:
    In this node you can define several row with different structure and indicate if a certain row must to be protected.
    Max
    Message was edited by: max bianchi

Maybe you are looking for

  • Using a different .Mac account in iPhoto

    We have a .Mac family pack. My wife and I each have a personal account and we would like to use a completely different .Mac account to post our web galleries, but I don't want to have to create a new user on my Mac just to use iPhoto. Is there a way

  • How do I use an iPhoto library stored on an external HDD (time capsule) on the new photos app?

    I have recently upgraded to a MacBook Air with the latest 10.10.3 updates as such it has photos installed, not iPhoto. The MacBook I'm upgrading from still had 10.9 and as such had iPhoto app. The MacBook air has a smaller SSD (128GB) than the HDD fr

  • How do i stop pop-ups from appearing on mac?

    I tried watching some movies online the other day and I don't know exactly what I pressed but ever since ads are appearing on safari and I don't know how to stop it. I tried downloading ad blocker but theres so many and I would have to block every si

  • Photo Gallery - Nested Albums

    Anyone have any hints or advice as to how i would take the photo gallery tutorial and transform it into one where i could use nested albums (albums inside of albums) instead of the flat approach that is outlines in the tutorial. i have thought of per

  • Re-Linking EXS Sampler Instruments & Samples

    1 - Curious what you think of this concept: I have an external drive that I'd like to be able to move to several computers and use as my samples drive. To keep things consistent, I thought it best to keep BOTH EXS Sampler Instruments & Samples on thi