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

smartform page numbers

Former Member
0 Likes
1,102

I am using 4.6C release...

I have a smartform, which consists of two pages.

The first one (COVERING_LETTER) doesn't output the page numbers as there is no requirement from the users. It is set to 'Initialize counter'.

The second page (NEXT) is set to 'Increase counter' and I have put &sfsy-page& of &sfsy-formpages& on a separate window.

When I preview my output (let's say 10 pages) I have '2 of 10' on the 2nd page, '3 of 10' on the 3rd one etc. Great!

But my users want to have '1 of 9' on the 2nd page, '2 of 9' on the 3rd etc.

How do I do it?

Kind regards,

Wojtek

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
998

Frédéric

That's a very good answer for a simple version of a covering letter where all the texts are static.

The wording of my covering letter varies and depends on a number of variables, which are set under Global definitions/Initialization. This is very much integrated with the whole output, therefore can not be separated as most of these variables are being used on the NEXT page.

If I create a separate smartform then I would have to set all these variables (some of the are tables) again. I'd like to keep it in just one smartform...

Thanks

Wojtek

I am using 4.6C release...

I have a smartform, which consists of two pages.

The first one (COVERING_LETTER) doesn't output the page numbers as there is no requirement from the users. It is set to 'Initialize counter'.

The second page (NEXT) is set to 'Increase counter' and I have put &sfsy-page& of &sfsy-formpages& on a separate window.

When I preview my output (let's say 10 pages) I have '2 of 10' on the 2nd page, '3 of 10' on the 3rd one etc. Great!

But my users want to have '1 of 9' on the 2nd page, '2 of 9' on the 3rd etc.

How do I do it?

Kind regards,

Wojtek

7 REPLIES 7
Read only

FredericGirod
Active Contributor
0 Likes
998

Hi Woktek,

You could create a smartform just for the Covering Letter. And in your program call the two smartforms.

Frédéric

Read only

0 Likes
998

Hello,

Simply subtract 1 from where the cover letter has reached or 2 if the cover letter is two pages and store it in another variable and print that variable.

Regards,

Shekhar Kulkarni

Read only

Former Member
0 Likes
999

Frédéric

That's a very good answer for a simple version of a covering letter where all the texts are static.

The wording of my covering letter varies and depends on a number of variables, which are set under Global definitions/Initialization. This is very much integrated with the whole output, therefore can not be separated as most of these variables are being used on the NEXT page.

If I create a separate smartform then I would have to set all these variables (some of the are tables) again. I'd like to keep it in just one smartform...

Thanks

Wojtek

Read only

0 Likes
998

Wojtek,

for this kind of problem, I create structure or table.

The first smartform set data into this table, and the second smartform read this data.

The problem with this solution is that you must create a structure in the dictionnary for your table.

Frédéric

Read only

Former Member
0 Likes
998

Shekhar

SFSY-PAGE and SFSY-FORMPAGES are internal variables therefore I think that they can't be used in a smartform as variables. Storing SFSY-PAGE in a local variable works fine with this piece of code:

I had to use 'symbol_value' form (in program saplstxbc) just to get the value and store it in my global variable:

DATA: value(255),

len TYPE i.

PERFORM symbol_value IN PROGRAM saplstxbc

USING 'SFSY-PAGE' '' CHANGING value len.

gd_page = value.

gd_page = gd_page - 1.

It won't work for SFSY-FORMPAGES as it will have the same value as SFSY-PAGE at runtime (I checked it by putting a breakpoint on my FM).

Somehow the system 'goes back' to the first page and loops through to the last page and resets the SFSY-FORMPAGES accordingly (after all the pages have been processed). I hope it still makes sense what I am trying to achieve.

Thanks,

Wojtek

Read only

0 Likes
998

Yes it's always the same method SAP use for the sy-pagno report, sapscript and smartform.

The only way is to create two smartforms.

Frédéric

Read only

Former Member
0 Likes
998

OK.

I will create two smartforms and all necessary DD structures.

Thanks,

Wojtek