cancel
Showing results for 
Search instead for 
Did you mean: 

Sapscript: &sapscript-formpages& - 1

Former Member
0 Kudos

Hi everybody,

I've got a sapscript with a page counter (page 1/3 for example), and I don't want that the total number of pages includes the last page of the sapscript. So if I'm on the second page of a 3 pages form, I should see : page 2/2.

Do you know how I could do that?

Thanks in advance!

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Gallina,

Try this way..

temp = &SAPSCRIPT-FORMPAGES& - 1.

and then print

&PAGNO& / &temp&.

Cheers...!

Jayaram..

Former Member
0 Kudos

Hi Jayaram,

You can't proceed substraction this way in a sapscript.

Thanks,

Emilie

Former Member
0 Kudos

hi,

Make use of &PAGE& '/'&SAPSCRIPT-FORMPAGES'.

Regards,

Shrita

Message was edited by: shrita sharma

Former Member
0 Kudos

Hi Shrita,

It doesn't work... I still have a total of 3 pages. Even if there are really 3 pages, I'd like to only have a count of 2, because the last page is not directly related to the previouses.

Thanks.

former_member181962
Active Contributor
0 Kudos

You may have to use performs in sap script:

/: DEFINE &TOTAL_PAGES& := '&SPACE(2)&'

/: PERFORM GET_COUNT IN PROGRAM ZGETCOUNT

/: USING &SAPSCRIPT-FORMPAGES&

/: CHANGING &TOTAL_PAGES&

/:ENDPERFORM

IN PROGRAM ZGETCOUNT:

FORM get_COUNT TABLES sap_data STRUCTURE itcsy

abap_data STRUCTURE itcsy.

DATA : COUNT LIKE SAPSCRIPT-FORMPAGES.

READ TABLE sap_data WITH KEY name = 'SAPSCRIPT-FORMPAGES'.

IF sy-subrc EQ 0.

MOVE sap_data-value TO COUNT.

COUNT = COUNT - 1.

ENDIF.

READ TABLE abap_data WITH KEY name = 'TOTAL_PAGES'.

IF sy-subrc EQ 0.

abap_data-value = COUNT.

MODIFY abap_data INDEX sy-tabix.

ENDIF.

ENDFORM. "GET_COUNT

Regards,

Ravi

Former Member
0 Kudos

Thanks Ravi,

But it still doesn't work...

When I arrive in the perform, the SAPSCRIPT-FORMPAGES has the value of the current page, not the total number of pages... It seems this value is calculated at the end of the sapscript, and not known before...

Cheers Emilie.