cancel
Showing results for 
Search instead for 
Did you mean: 

Finding last page in SAP Script when there are multiple layouts involved?

Former Member
0 Kudos

Hi,

I want to find out the last page in the SAP script. I have used &NEXTPAGE& = '0', this is finding the last page of a one layout however I do have three layouts in my script. I have also used the &SAPSCRIPT-JOBPAGES(3ZC)& and I have taken one counter and comapred as follows-

If &SAPSCRIPT-COUNTER_1(+)& = &SAPSCRIPT-JOBPAGES(3ZC)&

LAST PAGE.

endif.

This is also not working. Please advise if there is anyway to find out the last page from print program.

Thanks,

Jyoti

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Last page from print program? Impossible!

A print program does not know the window sizes of your form, how should it know what and how much will fit on a page?

Former Member
0 Kudos

Thanks for your reply. Is there any other way to get the solution of my problem?

Jyoti

Former Member
0 Kudos

well it depends at which point of time you need the information and for what purpose.

A print program normally only needs data to give it to the form and print them.

So you probably need the information if you are on last page, while printing the form, means in the form and not in the print program itself.

So in your form a "/: IF &NEXTPAGE& = 0", should work.

maybe it needs some tweaking like /: IF &NEXTPAGE& = ' 0', debug the printout to find this out.

so if you got something you just wish to print on the last page, do it between this if and an according endif.

Former Member
0 Kudos

Hi,

Try this

/: IF &NEXTPAGE& EQ 0 " Remove quotes '0'

/: ENDIF.

Regards

Krishna

Edited by: Krishna Gowrneni on May 7, 2009 7:29 PM

Edited by: Krishna Gowrneni on May 7, 2009 7:30 PM

Former Member
0 Kudos

&nextpage& = 0 is giving me last page correctly however that is only for perticular layout. I have continue three different layouts in my output. I want dead end page which I am getting by using &SAPSCRIPT-JOBPAGES(3ZC)& but again to use this there is some datatype mismatch for camparing it with counter as I descibed. My requirement is to print something only on last page of all three layouts.

Thanks,

Jyoti

Former Member
0 Kudos

Hi,

U can do like this, Set a flag in ur driver program when u reach to print the last layout then pass this flag value to Script. In script check when this FLAG = 'X' & &NEXTPAGE& = 0 then u print the required in ur last page.

Eg:

define a FLAG in ur driver program and make the value as 'X' when it reach the last layout.

in script, write the condition like:

/: IF &FLAG& = 'X' AND &NEXTPAGE& = 0

write text.

/: ENDIF.

Hope it helps!!

Rgds,

Pavan

Former Member
0 Kudos

Thanks Pavan,

That's my question how to find out end of the all three layouts. My print progam is very complicated developed by many people and also cloned from standard partly.

'Form_close' can not be end. I am not understanding where I can find out it's end.

Thanks,

Jyoti