cancel
Showing results for 
Search instead for 
Did you mean: 

Smartform and page numbering

matteo_montalto
Contributor
0 Kudos

Hello gurus,

I'm facing an odd requirement; shortly, I have a custom smartform which will print out a Purchase order which contains both material items and service items.

That smartform is build in the following way: first, it processes the material items. After that, page break and process services.

In a certain way, it produces a document which could be considered as the union of the material item list (first part) and the service summary (second part).

Now, the tricky requirement: I want to enumerate page numbers so that each page contains a windows reporting:

" Page X of Y"

where:

X represents the current page of the sub-document (material/service) and Y represent the total on that section (material/service)

Providing an example: suppose that a purchase order has a lot of material items, so that their output would fill 4 pages. Service items will fill the last 2 pages.

Here's the page numbering required for that document:

page 1 (material) : "Page 1 of 4"

page 2 (material) : "Page 2 of 4"

page 3 (material) : "Page 3 of 4"

page 4 (material) : "Page 4 of 4"

page 5 (service) : "Page 1 of 2"

page 6 (service) : "Page 2 of 2"

Is there any way to achieve such a desiderata?

SFSY-PAGE could be used to calculate X on each page, as for the first part it represents exactly the page number, while at the break for the services we could obtain X by subtracting from SFSY-PAGE the number of pages processed before the break (which we could store in a global variable).

The problem is Y; as far as I know, SFSY-JOBPAGES returns the overall number of pages for the smartform. So, for the services part, I could again retrieve Y by subtracting from SFSY-JOBPAGES the number of pages processed before the break page command.

But how can I - a priori - know how many pages of materials will be printed out?

Any suggestion/hint would be appreciated, thanks

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

try this

 

Page &SFSY-PAGE& of &SFSY-FORMPAGES&

matteo_montalto
Contributor
0 Kudos

hello,

it doesn't work; in this context, SFSY-FORMPAGES assumes the same value of SFSY-JOBPAGES so that is not a solution, unfortunately.

Given that no SFSY field can match the desiderata, I'm wondering about a tricky, custom way to achieve the required behaviour... any suggestion will be highly appreciated.

former_member203305
Active Contributor
0 Kudos

Hello.

maybe you can read the table with the data, check how many lines of materials and services you have there and then do some logic, something like

the table of the page just let me put 10 materials or 10 services, the table contains 25 materials and 15 services, so the logic should be sth like

table contains 25 lines of materials, so it means 3 pages. 10 lines per page.

table line of material from 0 to 10 : page 1

table line of material from 11 to 20 : page 2

table line of material from 21 to 30 : page 3

and the same for the services.

make a function to solve this problem.

Using the smartforms variables of SFSY wont work as you want. Shoulb be by code.

Regards

matteo_montalto
Contributor
0 Kudos

Unfortunately, things are more complex ( I had the same idea originally ) as there are more "minor" elements (windows, templates, graphics include) in the smartform and these are not fixed-length.

Thanks anyway for the input

Answers (6)

Answers (6)

vamsilakshman_pendurti
Active Participant
0 Kudos

Hi actually i thought ur requirement is like original and number of copies in that smart form thats y i suggested like that ...........(make a copy window .......)

Just now i red that one again so do this as follows

Make that window as final window and write this statement as...below

&SFSY-PAGE& of &SFSY-FORMPAGE&

Check it once....and let me know....is it working or not......

Regards

Vamsi......

former_member386063
Participant
0 Kudos

Hi Vamsi,

Not working.

Regards,

Titiksha

vamsilakshman_pendurti
Active Participant
0 Kudos

Hi Matio...

just observe that window which u want to display that page details ...which is either Secondary window OR Copies Window....

If it is secondary window then it might be get some problems ......

then make this window as Copies Window....

And then write the statement in that window as shown below.......for page details..

Page &SFSY-PAGE& of &SFSY-FORMPAGES&

it will work......

Regards,

Vamsi..............

former_member386063
Participant
0 Kudos


Hello Vamsi,

Please tell the option to be selected for copies window.

1) Original and copies-- copies differ

2) Original and copies-- Copies Identical

3) Only original

4) Only Copies-- copies differ

5) Only copies--copies Identical

Regards,

Titiksha

vamsilakshman_pendurti
Active Participant
0 Kudos

If ur requirement is like copies should be deffer from original then select as first option other wise select second option..

Its purely depends on ur requirement......

Regards

Vamsi...

former_member386063
Participant
0 Kudos

Hello Vamsi,

It doesn't work.

Thanks & Regards,

Titiksha

former_member386063
Participant
0 Kudos


Hello Matteo,

Have you got the solution?

I'm facing the same problem.

Please help.

Regards,

Titiksha

former_member375795
Participant
0 Kudos

Correct answer Which i found that  .

use

step 1: Call SSF_open .

Step2: call smartfrom  and store the name of function module

step 3 : loop ur data which u want to print .

step 4 : endloop

step 5 :SSF_close.

i write some code which may be use ful to any one

DATA : control_parameters TYPE ssfctrlop,

       wa_job_output_info TYPE ssfcrescl,

       ssfcompin TYPE ssfcompin,

       ssfcompop TYPE  ssfcompop.

  ssfcompin-dialog = 'X'.

CALL FUNCTION 'SSF_OPEN'

* EXPORTING

*   ARCHIVE_PARAMETERS       =

*   USER_SETTINGS            = 'X'

*   MAIL_SENDER              =

*   MAIL_RECIPIENT           =

*   MAIL_APPL_OBJ            =

*   OUTPUT_OPTIONS           =

*   CONTROL_PARAMETERS       =

* IMPORTING

*   JOB_OUTPUT_OPTIONS       = control_parameters

* EXCEPTIONS

*   FORMATTING_ERROR         = 1

*   INTERNAL_ERROR           = 2

*   SEND_ERROR               = 3

*   USER_CANCELED            = 4

*   OTHERS                   = 5

          .

IF SY-SUBRC <> 0.

* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

control_parameters-no_open = 'X'.

control_parameters-no_close = 'X'.

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

*    

      EXPORTING

        FORMNAME = SMARTFORM NAME

      IMPORTING

        FM_NAME  = PR_FM_NAME.

loop ur data

    CALL FUNCTION PR_FM_NAME

      EXPORTING

      control_parameters  = control_parameters

       output_options     = ssfcompop

      

      TABLES Which you want to print .

refresh the table aftr pass.

endloop

    

CALL FUNCTION 'SSF_CLOSE'

IMPORTING

job_output_info = wa_job_output_info

EXCEPTIONS

formatting_error = 1

internal_error = 2

send_error = 3

OTHERS = 4.

IF sy-subrc <> 0.

* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

Former Member
0 Kudos

Thanks Alok Jain, it's really worked out.

former_member375795
Participant
0 Kudos

just click as a correct answer , so it use full to other.

Former Member
0 Kudos

Hi  ,

Can you try moving the system variables to your local variables and do your manipulation and try printing them??

Declare the window you are using to display page no as FINAL window. I hope you are using a secondary window to do so. and before that window, just try to add your code to reduce the count of sfsy-form pages . 

I hope this will help you to resolve the issue & close this thread.

former_member375795
Participant
0 Kudos

I am getting same issue to print page number according to Po's  ,

Please help me out .

Former Member
0 Kudos

Hi Alok,

I hope you have tried this approach :

Declare the window you are using to display page no as FINAL window. I hope you are using a secondary window to do so. and before that window, just try to add your code to reduce the count of sfsy-form pages . 


Please revert in case you are still on same page .Thanks




Best Regards,

Praveen Srivastava

raymond_giuseppi
Active Contributor
0 Kudos

No evident as whatever we code the &SFSY-FORMPAGES&  and  &SFSY-JOBPAGES& are always increased by one, even if we can reset &SFSY-PAGE& with INITIALIZE option on new page.

An obvious trick would be to use 2 Smartforms, concatenated in one spool with NO_CLOSE/NO_OPEN options, so &SFSY-FORMPAGES& would be reset for second spool ?

Regards,

Raymond

gokul_radhakrishnan3
Active Participant
0 Kudos

Hi,

Did you play around with the smartform Page "Mode" Options in the "General Attributes" tab? Is it not helping?. It has 4 options like "Initialize Counter", "Increase Counter", "Leave counter unchanged" and "Page & overall Page unchanged". I am also checking whether your requirement can be achieved using these options or combining these options with some other.

Regards,

Gokul

matteo_montalto
Contributor
0 Kudos

Hi Raymond,

that could be a solution too but as the smartform is complex (and huge) and the triggering process is quite standard (an SRM custom smartform used for the print preview), splitting the SF itself in two is a challenging task... Gotta find another way to achieve the page numbering task, otherwise we'll simply give up and keep the smartform as it is.

The only problem actually seems to be: how to get the overall page number for the materials?

For what I've seen up to now, giving the pattern "Page X of Y":

For Material Pages (first part): X could be SFSY-PAGE, while Y is still to be determined (if there's a way :-P);

For Services Pages: X is again SFSY-PAGE, if we set that the counter for the page SERVICES should re-start from zero. Y should be SFSY-JOBPAGES (or FORMPAGES) - material pages.

matteo_montalto
Contributor
0 Kudos

Hello Gokul,

yes, I tried these options, and the only useful thing I obtained is to get the page counter reset at the first SERVICES pages. That means, for what concerns the pattern "Page X of Y", that X is not a problem anymore, both in materials and in service page.

Y remains the problem... Given the number of material pages, I could obtain the number of services pages by difference w.r.t. SFSY-JOBPAGES.

But my guess is that there's no straightforward method to get such an information, so we should work on a tricky solution

former_member206439
Contributor
0 Kudos

Hi Matteo,

Did you find any Solution for the above requirment?

I have the similar issue and unable to get the Y value.

Could you please help me in resolving this issue.