Skip to Content
avatar image
Former Member

Need to print some text only in last page in SAP script

Moved to correct forum by Moderator. General wasn't right either.

Hi All.

I need to print "Remarks" only in last page of sap script.

Can anyone please help me on this.

Thanks

Senthil kumar V.

Edited by: Matt on Nov 21, 2008 7:38 AM

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

6 Answers

  • avatar image
    Former Member
    Nov 20, 2008 at 08:52 PM

    In SAPscript, there are a few ways to print text only on the last page. The logical approach depends on whether you are using the MAIN window or a secondary window to print the text. If you are printing this text in the MAIN window, then simply put the words in a text element which prints last. If your footer is outside/below the MAIN window, then you'll want to use a secondary window-based approach.

    If using a secondary window, one possibility is comparing the value in SAPscript symbol PAGE with SAPSCRIPT-FORMPAGES. When they are equal, have the text print; otherwise, have nothing print. However, these variables are not exactly the same. To make them 'apples-to-apples', insert a control command in your SAPscript form similar to a formatting command, for example:

    /: IF &PAGE(3ZC)& = &SAPSCRIPT-FORMPAGES(3ZC)&

    • [your END OF PAGE text here]

    /: ENDIF

    Another option is to simply check if &NEXTPAGE& ='0'. This should achieve the same results.

    Regards

    Raj

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Nov 20, 2008 at 08:56 PM

    Add the following to the sapscript main window.

    /E LAST_PAGE_LOGIC

    /: IF &V_LOGIC& NE &SPACE&

    Z1 <A>Footer</>

    /: ENDIF

    your sapscript program should have the following logic at the end.

    data: v_logic type c.

    v_logic = 'X'.

    CALL FUNCTION 'WRITE_FORM'

    EXPORTING

    element = 'LAST_PAGE_LOGIC'

    EXCEPTIONS

    element = 1

    window = 2.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Nov 21, 2008 at 06:41 AM

    Hi,

    /:IF &nextpage& eq '0'

    • Remarks

    /:endif

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 24, 2009 at 07:54 AM

    Hi,

    you have 4 possibilities.2 at non main window, 2 at main window.

    at non main window.

    1. /: IF &PAGE(C)& = &SAPSCRIPT-FORMPAGES(C)&

    • remarks

    • remarks

    • remarks

    /: ENDIF

    2, /: if &NEXTPAGE& ='0'.

    • remarks

    • remarks

    • remarks

    /: ENDIF

    at main window

    3. Add the remarks at the last item of the main which is printed

    4. add a new item to your main (/E)

    put your remarks in it.

    Change your program in such a way this item will print as last one.

    like

    /E REMARKS

    • remarks

    • remarks

    • remarks

    and in sapscript program add logic at the end.

    CALL FUNCTION 'WRITE_FORM'

    EXPORTING

    element = 'REMARKS'

    EXCEPTIONS

    element = 1

    window = 2.

    I am sure this will do. Make a choice.

    Gr., Frank

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 24, 2009 at 08:04 AM

    Hi,

    You can use &nextpage& = 0 condition for displaying remarks in last page..

    you can also do it through your print program

    try this....

    assign text element to the remarks...

    loop at itab

    call function write_form

    at last.

    call function write_form -- in the elements parameter pass the text element used for remarks

    endat.

    endloop.

    this should work

    regards

    padma

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi,

      @Padma,

      why have you a solution inside a loop for something that has to be done last?

      below is easier:

      loop at itab

      call function write_form

      endloop.

      call function write_form -- in the elements parameter pass the text element used for remarks

      Gr., Frank

  • avatar image
    Former Member
    Apr 24, 2009 at 11:27 AM

    Hi Senthil,

    at last.
          call function 'WRITE_FORM'
           exporting
           element                          = 'REMARKS'
    *   FUNCTION                            = 'SET'
    *   TYPE                                = 'BODY'
             window                         = 'MAIN'

    Regards,

    Sravanthi

    Add comment
    10|10000 characters needed characters exceeded