Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

SapScript $SAPSCRIPT-FORMPAGES& change

Former Member
0 Likes
818

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
688

Hi,

i would try following:

/E PAGE

/: define &SAPSCRIPT-COUNTER_1& = $SAPSCRIPT-FORMPAGES&

/: &SAPSCRIPT-COUNTER_1+&

= &SAPSCRIPT-COUNTER_1&

regards

Stefan Seebruger

4 REPLIES 4
Read only

Former Member
0 Likes
689

Hi,

i would try following:

/E PAGE

/: define &SAPSCRIPT-COUNTER_1& = $SAPSCRIPT-FORMPAGES&

/: &SAPSCRIPT-COUNTER_1+&

= &SAPSCRIPT-COUNTER_1&

regards

Stefan Seebruger

Read only

0 Likes
688

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

Read only

0 Likes
688

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

Read only

0 Likes
688

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