cancel
Showing results for 
Search instead for 
Did you mean: 

How to determine LASTPAGE

Former Member
0 Kudos

Hi gurus,

Heres my scenario.

I have more than two pages form.

Now the word "TOTAL AMOUNT DUE", must only be written on the lastpage of the form and on the first and the succeeding pages , the word "SUBTOTAL AMOUNT DUE" must be written.

So what i did is, I write a code on the program lines. And here it is:

if sfsy-page = sfsy-formpages.

subname = 'TOTAL Amount Due'.

else.

subname = 'SUBTOTAL Amount Due'.

ENDIF.

I know that sfsy-page will output the current page number and sfsy-formpages output the total number of pages. Thus i just check if sfsy-page and sfsy-formpages are just the same to determine the lastpage of the form.

But when I run and debug the program, sfsy-page and sfsy-formpages are always the same wherein fact, it should be not.

How could i solve this problem?

Accepted Solutions (0)

Answers (6)

Answers (6)

Former Member
0 Kudos

thanks

Former Member
0 Kudos

Hi,

Use the ALTERNATIVE in a window.

select a window >right click>create--->

flow logic-->Alternative->in general attributes select ONLY AT PAGE BREAK.

1.In TRUE write the text 'SUBTOTAL Amount Due'

2. In FALSE write the text TOTAL AMOUNT DUE

Former Member
0 Kudos

Hi,

Just create a window as a Final window and position it correctly .

Under that window create an alternative with the condition ...

SFSY-PAGE = SFSY-FORMPAGES in its general attributes.

place the text node to print TOTAL ...in the true part.

place the SUB TOTAL text node in the false part.

Thats it....

Regards,

Ram

Former Member
0 Kudos

Hi Levis 501,

PAGE1:

FOR SUBTOTAL DUE:

In the main window --> table --> Footer --> create the text node

for the SUBTOTAL AMOUNT DUE.

Create the command node:

NExT PAGE : PAGE2

TOTAL AMOUNT DUE:

create the secondary window after the main window and create

the text node for the text node TOTAL AMOUNT DUE and display.

Regards,

Sravanthi

Former Member
0 Kudos

Hi,

Do the following steps,

1. Create a folder and put condition as 'Only on Last Page'.

Under this folder,

a. Create program lines with a flag set to 1, say w_last_page = 1.

b. Create text element for TOTAL AMOUNT DUE.

Former Member
0 Kudos

Hi,

The last post wasn't complete. Do the following steps,

1. Create a folder and put condition as 'Only on Last Page'.

Under this folder, create the following 2 elements without condition

a. Create program lines with a flag set to 1, say w_last_page = 1.

b. Create text element for TOTAL AMOUNT DUE.

2. Outside this folder, create a text element for SUBTOTAL AMOUNT DUE. Put the condition as w_last_page <> 1 or w_last_page = 0.

Try it, it should work.

Best Regards.

former_member387317
Active Contributor
0 Kudos

Hi levis,

Use Final Window for it...

Have a look on below thread..

Also have a look on below OSS notes..

https://service.sap.com/sap/support/notes/588352

Hope it will solve your problem..

Thanks & Regards

ilesh 24x7

Former Member
0 Kudos

hi,

thanks for your replies..

but still i cant solve my problem..

actually i made two pages since page must have a header but not like the succeeding pages.

now, when i change my MAIN window on the firs page to FINAL Window, there is now an error and it states,

"SECONDPAGE A page without a main window cannot point to itself as next page"

From the answer on the thread you gave to me, Venkat states that I have to place another window after the Main window. I did it and it works.

Let say, i have two pages, on the first page the word "SUBTOTAL" does not appear but on the lastpage,

the word "TOTAL AMOUNT" appears. Well this output is fine for me. As long as I can see the word "TOTAL AMOUNT" on the lastpage.

However, if the case now is just Only one page, then this solution given above doesn't work anymore.

Are there anymore ideas to solve my problem..

I would like to repeat my requirement...

If I only have one page of report, the word "TOTAL AMOUNT" must appear at the footer of the table.

But if the form has two or more pages, the word "SUBTOTAL AMOUNT" must appear on the first page and on the succeeding pages except on the lastpage which is "TOTAL AMOUNT".

Thanks again for your replies.

Former Member
0 Kudos

this is al standard smartform.

short description:

you have your table-node in your main window.

the table node has 3 child-nodes. one is a header and one is the footer.

within the tabel node you can fill your calculation tab with the field subtotal.

print subtotal in the header as first item-line with the condition: not on first page. in the footer print text subtotal when subtotal ne total or print text total when subtotal eq total.

Regards,

Guido