cancel
Showing results for 
Search instead for 
Did you mean: 

Issue in displaying 2 or 3 smartform pages with same data

former_member242512
Participant
0 Kudos

Hi All

I have some unusual requirement.

Depending on specific customer fied value i have to to display 2 or 3 copies in print preview.

My invoice data will never flow out of 1 page since we have used corresponding split for it that helps data will be limited to 1 page.

So the invoice form currently is of one page.

Now if some specific customer fied is X , there should be 2 pages in print preview with same data but with difference of some specifc harcoded text.

If this specific customer field is blank, there should be 3 pages in print preview with exactly same data but with difference only some specifc harcoded text.

It will be like :   '###### page 1 '

                       'yyyyyyy page 2'

                      'zzzzzz page 3' 

and other data in all these pages will be same.

Please help how can i achieve this requirement.

Thanks.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Ujj,

Do follow below process code,

call function 'SSF_OPEN'
   exporting

      user_settings            = 'X'.

loop at itab into wa.   "if you are passing single record, then no need of loop directly pass WA and check the condition(i.e. Customer flag).

1st perview

perform call_smartform.

if cust_flag = 'X'.

2nd perview

*your hardcoding and passing to smartform layout

perform call_smartform.  "Call smartform function module in the subroutine

else.

2nd perview

*your 2nd print harding coding and passing to smartform layout

3rd perview

*your 3rd harding coding and passing to smartform layout

endif.

endloop.

**Call below Function module for closing your smartforms

call function 'SSF_CLOSE'

   * IMPORTING
*   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.

hope it will work for ur requirement.

Thanks,

Regards,

Praveen Reddy

former_member242512
Participant
0 Kudos

Hi Praveen.....   thanks for reply . But its getting previewed in different print previews. Can it be displayed in single print preview ?

Former Member
0 Kudos

Hi Ujj,

Pass below parameters before calling smartform function module as show below.

 

wa_control_parameters-no_open = c_x.

wa_control_parameters-no_close = c_x.

wa_control_parameters-preview = c_x.

wa_control_parameters-device = 'PRINTER'.

 

CALL FUNCTION g_fmname  " Smartform name

EXPORTING

control_parameters = wa_control_parameters

output_options = wa_output_options    

user_settings = 'X'

wa_final = wa_final

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.

Hope it will solve your problem.

Regards,

Praveen Reddy

former_member242512
Participant
0 Kudos

Thanks a lot ..  just one thing the spool is not getting created though im not getting sy-subrc greater than 0...... Can you please suggest what can be issue.

Answers (4)

Answers (4)

former_member242512
Participant
0 Kudos

Thanks a lot the issue is solved now.

vinoth_aruldass
Contributor
0 Kudos

you can define smartform with 2 and 3 pages in program you can validate your condtion and call the smartform.

hope it helps,

Vinoth

vinoth_aruldass
Contributor
0 Kudos

hi,

inside the smartforms inside pages put these conditons. it will work.

former_member242512
Participant
0 Kudos

Hi ... Can you please tell me in detail how we can put conditions inside the smartforms to show this data.

former_member195270
Active Participant
0 Kudos

There can be different solutions.

solution 1. You can call smartforms two / three times and send different harcoded text in different call.

solution 2. You can send data to smart form so that It can be display in two or three pages depending on the data sent.