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

Print several Smart Forms within a loop

Former Member
0 Likes
793

Hi all,

I have the following situation: I need to print a form several times depending on the quantity of customers the user selects, being each customer a different form. Now, I have implemented this correctly, how ever, each time the smart form function is called within the loop the system displays the printing popup window (the one which asks for print preview, print, etc). The user doesn't want this window to be displayed every pass of the loop but up to the end of the loop, so the window is displayed just once for the set of forms. Also they want to be able to preview all the smart forms at once.

Is this possible? Your help on this will be very appreciated.

A very simplified version of the case would be the following:

DO 100 TIMES.

PERFORM display_cust_ar.

ENDDO.

FORM display_cust_ar.

DATA: cf_retcode LIKE sy-subrc.

DATA: lf_fm_name TYPE rs38l_fnam.

DATA: lf_formname TYPE tdsfname.

lf_formname = 'NAME.

SORT t_line BY kunnr.

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

formname = lf_formname

IMPORTING

fm_name = lf_fm_name

EXCEPTIONS

no_form = 1

no_function_module = 2

OTHERS = 3.

IF sy-subrc <> 0.

  • error handling

cf_retcode = sy-subrc.

ENDIF.

CALL FUNCTION lf_fm_name

EXPORTING

p_multiple_lines = i_multiple_clients

TABLES

p_header = t_header

p_lines = t_line_final2

p_total = t_total_final

EXCEPTIONS

formatting_error = 1

internal_error = 2

send_error = 3

user_canceled = 4

OTHERS = 5.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
693

Hi Alejandro,

<b>Is your problem solved....?</b>

Since you want to display the pop-up only once for entire set, you can do like this.

<b>declare a variable called count.

declare another variable for user settings (say set).</b>

<u>Outside the loop</u>

ctrl_param-preview = space.

out_option-tddest = 'LP01'.

Within the loop, check if the count is equal to 1.

Then

put

<b>ctrl_param-no_dialog = space.

set = 'X'</b>.

Else

<b>ctrl_param-no_dialog = 'X'.

set = space</b>.

Now call the FM SSF_FUNCTION_MODULE_NAME and the generated Function Module

<b>with user_settings = set</b>

I think this should solve your problem.

<b>Close the thread once the problem is solved.</b>

Regards,

SP.

4 REPLIES 4
Read only

Former Member
0 Likes
693

You need to set and send the control parameters to your form.

CONTROL_PARAMETERS TYPE SSFCTRLOP.

set the No_Dialog to 'X' and Preview to space.

Read only

Former Member
0 Likes
693

Hi Alejandro,

The pop up window can be suppressed like this.

data: ctrl_param type ssfctrlop,

out_option type ssfcompop,

fm_name type rs38l_fnam.

<b>ctrl_param-preview = <i>space</i>.

out_option-tddest = 'LP01'. "name of the printer

ctrl_param-no_dialog = 'X'.</b>

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

formname = gv_form

  • VARIANT = ' '

  • DIRECT_CALL = ' '

IMPORTING

fm_name = fm_name

EXCEPTIONS

no_form = 1

no_function_module = 2

OTHERS = 3

.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

call function fm_name

exporting

<b>control_parameters = ctrl_param

output_options = out_option

user_settings = space</b>

tables

itab = itab[]

exceptions

.

.

.

This will work.

<b>Close the thread once the problem is resolved.</b>

Regards,

SP.

Read only

Former Member
0 Likes
693

Hi,

data: ls_composer_param type ssfcompop.

if count > 99

ls_composer_param-TDNOPREV = 'X' .

endif .

call function lf_fm_name

exporting

output_options = ls_composer_param

... ...

....

.

try this, I guess this should work .

Regards,

Varun

Read only

Former Member
0 Likes
694

Hi Alejandro,

<b>Is your problem solved....?</b>

Since you want to display the pop-up only once for entire set, you can do like this.

<b>declare a variable called count.

declare another variable for user settings (say set).</b>

<u>Outside the loop</u>

ctrl_param-preview = space.

out_option-tddest = 'LP01'.

Within the loop, check if the count is equal to 1.

Then

put

<b>ctrl_param-no_dialog = space.

set = 'X'</b>.

Else

<b>ctrl_param-no_dialog = 'X'.

set = space</b>.

Now call the FM SSF_FUNCTION_MODULE_NAME and the generated Function Module

<b>with user_settings = set</b>

I think this should solve your problem.

<b>Close the thread once the problem is solved.</b>

Regards,

SP.