Application Development 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: 

In Smartform Page No printing issue

sanjeeb_sahoo
Participant
0 Kudos

Dear experts,

I have smartforms for Delivery note. The input field is delivery note no i.e LIKP-VBELN as select-option. When I am taking printout for one delivery note then the Page No i.e  Page - &SFSY-PAGE&(&SFSY-FORMPAGES&) is showing correctly. But when I am giving a range of delivery note, for example - 803000075 to 803000085 then the page no is showing

as in  803000075 as  Page - 1(11).

But it should be  Page - 1(1) and if in this delivery note has more line items and it contains 2nd page then the page 2 should be  Page - 1(2).

in  803000076 as  Page - 2(11).

But it should be  Page - 1(1) and if in this delivery note has more line items and it contains 2nd page then the page 2 should be  Page - 1(2).

Like this...........

Please reply me how can it possible. The clients requirement is like this.

Thanks,

Sanjeeb

17 REPLIES 17

deependra_shekhawat3
Contributor
0 Kudos

Hi,

How do you calling the Smartform.

if you are using a drive program and  you are passing delivery number to smartform , pass the single del. number in loop to SF.

that will work fine...

Thanks

Deeps

0 Kudos

Hi Deeps,

Thanks for your reply.

Yes I m using the driver program and I am passing the delivery note as select-option which is requirment of client. The out put is correct for the data, only the page no problem is showing which is mentioned before. If any solution please reply.

Thanks,

Sanjeeb.

0 Kudos

Just try to paas Delivery number in loop to smartform.

    loop at it_likp into is_likp.
    lv_vbeln = is_likp-vbeln.


*     Now Call the Generated Function Module
    CALL FUNCTION fm_name
      EXPORTING
        w_id               = fm_name
        control_parameters = wa_control_parameters
        wmblnr             = lv_vbeln

      EXCEPTIONS
        formatting_error   = 1
        internal_error     = 2
        send_error         = 3
        user_canceled      = 4
        others             = 5.

    if sy-subrc <> 0.
      perform message_build.
    endif.
  endloop.

0 Kudos

I have tryed with this code but same result. The page no is showing like before.

0 Kudos

sanjeeb,

Tell me one thing, are you getting SFSY values in debugger ?

if yes then there is one more way to get all pages like page &SFSY-PAGE& of &SFSY-JOBPAGES&

i think it will work fine with my code in earlier post...

Thanks,

Deeps

udaykumar_kanike
Active Contributor
0 Kudos

hi sanjeeb,

                its a standard format to display total number of pages in bracket and the page number you are on before the bracket starts.

I dont think it is possible to display in reverse.

regards

uday

0 Kudos

Hi Uday,

If u don't know, please don't reply like this.

Thanks,

Sanjeeb.

madhu_vadlamani
Active Contributor
0 Kudos

Hi,

Is it a custom one.

Regards,

Madhu.

venkateswaran_k
Active Contributor
0 Kudos

hi Sanjeeb,

Since you are passing the range of delivery documents in the driver program to the smartform, it will work like this only.

As deepnedra said you have to call the smartform for each time in a loop.  Then you will get as you required.

Regards,

Venkat

0 Kudos

Dear Sanjeeb

There is one work around for this.  May be you try this..

1. Find out how many line items the form is printing in a page.  Take one big delivery note and find it.

2. Suppose it prints 10 line items per page... for example

3. In your driver program, estimte the number of pages required by dividng it by 10...  Pass that variable to the smart form interface variable.

4. Use that variable instead of SY-FORMPAGES

Regards,

Venkat

raymond_giuseppi
Active Contributor
0 Kudos

You cannot force change of SFSY-FORMPAGES in a SmartForm run as you can for SFSY-PAGE using General Attributes tab of the page node. The SFSY-PAGE is used "real time" when the SFSF-FROMPAGES is used "at late".

So the easiest solution would be to call the form one document at a time in a loop as some members have already suggested.

With much more effort you could "play" with saving data during normal processing and "some" code in late windows, but I never had the time to do this kind of development.

Regards,

Raymond

0 Kudos

Hi Raymond,

If there is any solution please reply.

Thanks,

Sanjeeb

0 Kudos

Hi, Follow the below approch.

You need to call the function modules SSF_OPEN and SSF_CLOSE for every new delivery note.

    output-tdimmed = ' '.
    output-tdnoprev = ' '.
    output-tddest = 'LOCL'.

    control-no_open = 'X'.
    control-no_close = 'X'.
    control-no_dialog = 'X'.

ON CHANGE OF LIKP-VBLEN.

   CALL FUNCTION 'SSF_OPEN'
EXPORTING
*   ARCHIVE_PARAMETERS       =
*   USER_SETTINGS            = 'X'
*   MAIL_SENDER              =
*   MAIL_RECIPIENT           =
*   MAIL_APPL_OBJ            =
   OUTPUT_OPTIONS           = output
   CONTROL_PARAMETERS       = control
* IMPORTING
*   JOB_OUTPUT_OPTIONS       =
EXCEPTIONS
   FORMATTING_ERROR         = 1
   INTERNAL_ERROR           = 2
   SEND_ERROR               = 3
   USER_CANCELED            = 4
   OTHERS                   = 5
              .
    IF SY-SUBRC <> 0.
* Implement suitable error handling here
    ENDIF.

END ON

********SMARTFORM CALL*******

AT END OF VBELN.

      CALL FUNCTION 'SSF_CLOSE'
* IMPORTING
*   JOB_OUTPUT_INFO        =
* EXCEPTIONS
*   FORMATTING_ERROR       = 1
*   INTERNAL_ERROR         = 2
*   SEND_ERROR             = 3
*   OTHERS                 = 4
              .
    IF SY-SUBRC <> 0.
* Implement suitable error handling here
    ENDIF.

ENDAT.

0 Kudos

I have applied this it is also not working.

0 Kudos

I have checked with the above approach and it is working for me.

Paste your code for further analysis.

venkateswaran_k
Active Contributor
0 Kudos

Dear Sanjeeb

There is one work around for this.  May be you try this..

1. Find out how many line items the form is printing in a page.  Take one big delivery note and find it.

2. Suppose it prints 10 line items per page... for example

3. In smartform code estimte the number of pages required by dividng it by 10.(example)..  

4. Use that variable instead of SY-FORMPAGES

Regards,

Venkat

0 Kudos

In line item there is a description field. If the description length is more then the number of line item per page is decrease. so the number of line item in a page is not constant. So we cann't cosider this.

If there is any other solution please reply.