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

SMARTFORMS: Multiple prints with one call.

Former Member
0 Likes
1,188

Hi all, I need to print several certificates using just one call to the smartforms function.

The structure of the internal table that i'm using is

cert_number

kunnr

  • other data...

now, there will be several kunnr for one cert_number, and I need to print every cert_number per page with all the kunnrs in it.

i did it as follow:

    • BEGIN OF CODE **

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

formname = 'ZCLFI_WITTHOLD_001'

IMPORTING

fm_name = l_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.

control-no_dialog = 'X'.

control-preview = 'X'.

control-no_open = 'X'.

control-no_close = 'X'.

CALL FUNCTION 'SSF_OPEN'

EXPORTING

control_parameters = control

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.

EXIT.

ENDIF.

SORT it_data BY cert_number.

LOOP AT it_data.

APPEND it_data TO print_data.

AT END OF nro_cert.

CALL FUNCTION l_fm_name

EXPORTING

control_parameter = control

date = date

year = gjahr

it_data = print_data[]

p_name = p_name

p_rut = p_rut

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.

REFRESH print_data.

ENDAT.

ENDLOOP.

CALL FUNCTION 'SSF_CLOSE'

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.

CALL FUNCTION 'SSF_READ_ERRORS'

IMPORTING

errortab = errtab.

IF NOT errtab IS INITIAL.

  • Error analysis here....

ENDIF.

    • END OF CODE **

the problem is that in the first loop pass i get the following error message:

Previous output request was not finished.

Message no. SSFCOMPOSER150

Diagnosis

A previous output request has not been finished. Therefore you are not allowed to start a new output request.

System Response

The system issues an error message.

Procedure

Check the sequence in which you call the function modules SSFCOMP_OPEN and SSFCOMP_CLOSE.

The order of the FM i think they are ok, so i don't know what could be the problem. Any help is welcome!

Thanks in advance, and regards.

Mauro.

Hi all, I need to print several certificates using just one call to the smartforms function.

The structure of the internal table that i'm using is

cert_number

kunnr

  • other data...

now, there will be several kunnr for one cert_number, and I need to print every cert_number per page with all the kunnrs in it.

i did it as follow:

    • BEGIN OF CODE **

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

formname = 'ZCLFI_WITTHOLD_001'

IMPORTING

fm_name = l_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.

control-no_dialog = 'X'.

control-preview = 'X'.

control-no_open = 'X'.

control-no_close = 'X'.

CALL FUNCTION 'SSF_OPEN'

EXPORTING

control_parameters = control

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.

EXIT.

ENDIF.

SORT it_data BY cert_number.

LOOP AT it_data.

APPEND it_data TO print_data.

AT END OF nro_cert.

CALL FUNCTION l_fm_name

EXPORTING

control_parameter = control

date = date

year = gjahr

it_data = print_data[]

p_name = p_name

p_rut = p_rut

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.

REFRESH print_data.

ENDAT.

ENDLOOP.

CALL FUNCTION 'SSF_CLOSE'

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.

CALL FUNCTION 'SSF_READ_ERRORS'

IMPORTING

errortab = errtab.

IF NOT errtab IS INITIAL.

  • Error analysis here....

ENDIF.

    • END OF CODE **

the problem is that in the first loop pass i get the following error message:

Previous output request was not finished.

Message no. SSFCOMPOSER150

Diagnosis

A previous output request has not been finished. Therefore you are not allowed to start a new output request.

System Response

The system issues an error message.

Procedure

Check the sequence in which you call the function modules SSFCOMP_OPEN and SSFCOMP_CLOSE.

The order of the FM i think they are ok, so i don't know what could be the problem. Any help is welcome!

Thanks in advance, and regards.

Mauro.

1 REPLY 1
Read only

Former Member
0 Likes
514

More info about this problem: When i call the smartforms FM

it seems to be a problem with the control_parameters (se the code in the previous message) parameter, because the values that are stored in the structure control, are lost when the program goes to the smartform FM and the parameter CONTROL_PARAMETERS is empty.

This is really weird, and I don't know why is happening....