Skip to Content
avatar image
Former Member

SAPScript - condition on pages for box.

hey guys,

I would like to ask on how to do i put a condition according to pages?

for example:

i would like to draw box on all pages but at the last page, i do not want to print the box.

the coding that i tried is this:

/:  IF &PAGES& NE &PAGE&
/:  BOX XPOS 0 MM YPOS 43 MM  FRAME 10 TW WIDTH 59 MM HEIGHT 216 MM
/:  ENDIF

but still, it print the box in all pages....

can anyone help me...!!!

thanks in advance!!!!

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

6 Answers

  • avatar image
    Former Member
    Jun 22, 2009 at 04:24 AM

    Hi,

    Try to debugg the code and check whether the value is getting passed to variable &Pages&

    May there may not be any value in this variable.

    Regards,

    Prashant

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 22, 2009 at 04:31 AM

    Hi,

    Try with this if condition.

    /: IF &SAPSCRIPT-FORMPAGES& NE &PAGE&
    /: BOX XPOS 0 MM YPOS 43 MM  FRAME 10 TW WIDTH 59 MM HEIGHT 216 MM
    /: ENDIF

    or

    when you want the box in all the pages then you might have taken it in the variable window.

    so you can even give the condition

    /: IF &NEXTPAGE& NE '0'
    /: BOX XPOS 0 MM YPOS 43 MM  FRAME 10 TW WIDTH 59 MM HEIGHT 216 MM
    /: ENDIF

    Thanks&Regards

    Sarves

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 22, 2009 at 04:36 AM

    Hi!

    You can try Writing the Condition as....

    /: IF &PAGE& NE &SAPSCRIPT-FORMPAGES&

    /: BOX XPOS 0 MM YPOS 43 MM FRAME 10 TW WIDTH 59 MM HEIGHT 216 MM

    /: ENDIF

    AND TRY...

    Regards.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 22, 2009 at 05:33 AM

    Hi,

    try like below:

    /: IF &NEXTPAGE& NE '0'

    /: BOX....

    /: ENDIF.

    &NEXTPAGE& will always be 0 when it reaches to last page to print.

    Hope it helps!!

    Rgds,

    Pavan

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 22, 2009 at 06:25 AM

    HI,

    IF &NEXTPAGE& NE '0'.

    BOX

    ENDIF.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 22, 2009 at 09:18 AM

    this statement is working

    IF &NEXTPAGE& NE 0
    BOX...
    ENDIF.
    

    but guys when i try to do for the lastpage i try to execute the dynamic box condition, (the coding below)

    IF &NEXTPAGE& EQ 0
     BOX XPOS 0 MM WIDTH 0 MM HEIGHT 5 MM FRAME 20 TW
     BOX XPOS 59 MM WIDTH 0 MM HEIGHT 5 MM FRAME 20 TW
     BOX XPOS 84 MM WIDTH 0 MM HEIGHT 5 MM FRAME 20 TW
     BOX XPOS 107 MM WIDTH 0 MM HEIGHT 5 MM FRAME 20 TW
    POSITION YORIGIN +5 MM
    ENDIF.
    ,,&ilist-zname1&,,&ws1(R)&,,&ws2(R)&,,&ws3(R)&,,&ws4(R)&,,&ws5(R)&,,
    

    it doesnt execute the box...

    i also try this for the condition

    IF &PAGE& EQ &SAPSCRIPT-FORMPAGES&
    BOX
    ENDIF
    

    also doesn't working...

    can u guys help me..

    Thanks in advance.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Bob,

      The statement IF &nextpage& eq '0' doesnot work in the main window, this is because the main window will always have the next page number only variable window will contain the nextpage as '0' if there is no next page so this statement works in the variable window only.

      The statement &PAGE& EQ &SAPSCRIPT-FORMPAGES& will also not work this is because the formpages will get generated only in the runtime for each page.

      so take the box commands which you want to get printed in a seperate variable window and call the box commands like this

      Ex: Variable window 3

      IF &NEXTPAGE& EQ 0
       BOX XPOS 0 MM WIDTH 0 MM HEIGHT 5 MM FRAME 20 TW
       BOX XPOS 59 MM WIDTH 0 MM HEIGHT 5 MM FRAME 20 TW
       BOX XPOS 84 MM WIDTH 0 MM HEIGHT 5 MM FRAME 20 TW
       BOX XPOS 107 MM WIDTH 0 MM HEIGHT 5 MM FRAME 20 TW
      POSITION YORIGIN +5 MM
      ENDIF.

      This will definitely work.

      Thanks&Regards

      Sarves