‎2014 Oct 01 11:54 AM
Hello Experts,
I have a sapscript and i want $SAPSCRIPT-FORMPAGES& output to be minus 1. For example if i have 10 pages i want the output to be 9.
Regards
‎2014 Oct 01 3:12 PM
Hi,
i would try following:
/E PAGE
/: define &SAPSCRIPT-COUNTER_1& = $SAPSCRIPT-FORMPAGES&
/: &SAPSCRIPT-COUNTER_1+&
= &SAPSCRIPT-COUNTER_1&
regards
Stefan Seebruger
‎2014 Oct 01 3:12 PM
Hi,
i would try following:
/E PAGE
/: define &SAPSCRIPT-COUNTER_1& = $SAPSCRIPT-FORMPAGES&
/: &SAPSCRIPT-COUNTER_1+&
= &SAPSCRIPT-COUNTER_1&
regards
Stefan Seebruger
‎2014 Oct 01 3:48 PM
If i'm right &SAPSCRIPT-FORMPAGES& will not take its actual value untill the end of the script so you logic seems to be wrong
‎2014 Oct 01 4:15 PM
Hi,
hmm yea you are right... well then you have to count yourself.
for example befor each close/end from the actual page is the last page.
and then you can go as written above with the page variable.
i guess you add a last page and dont want this to be included in the total?
regards
Stefan Seeburger
‎2014 Oct 02 11:25 AM
I found the answer so i'll write it down so everyone that wants to do something similar can use this.
I have a last page so when it after it is called through control_form -> new_page i call an element in this form that contains a perform in a zprogram i wrote.
In SapScript
/E PAGE_COUNTER
/: PERFORM GET_SAPSCRIPT_FORMPAGES IN PROGRAM ZDED_MME_FIX_PAGE
/: USING &PAGE&
/:ENDPERFORM
In Program
FORM GET_SAPSCRIPT_FORMPAGES TABLES INPUT1 STRUCTURE ITCSY
OUTPUT1 STRUCTURE ITCSY.
READ TABLE INPUT1 INDEX 1.
CALL FUNCTION 'TEXT_SYMBOL_SETVALUE'
EXPORTING
NAME = 'FORMPAGES'
VALUE = input1-value.
ENDFORM.
So the point is that i use system variable &PAGE& to change system variable &FORMPAGES& when page is set actually to formpages-1.
Thanks for your replies