‎2012 Nov 08 8:40 AM
Hello,
I need to pass a static output device in my code but I get an error.
My code is something similar to this:
DATA :
gs_control_parameters TYPE SSFCTRLOP,
gs_output_options TYPE SSFCOMPOP.
gs_control_parameters-no_dialog = 'X'.
gs_output_options-XDFOUTDEV = 'PRUEBA'.
* gs_output_options-tddest = 'PRUE'.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = 'MYFORM'
VARIANT = ' '
DIRECT_CALL = ' '
IMPORTING
FM_NAME = v_fm
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.
gs_output_options-tdnewid = 'X'.
WHILE pnet > 0.
if pnet = 1.
gs_output_options-tdfinal = 'X'.
endif.
CALL FUNCTION v_fm
EXPORTING
control_parameters = gs_control_parameters
output_options = gs_output_options
zmatnr = pmat-low
zlot = plot-low
zfem = pfemb
zpes = ppeso.
pnet = pnet - 1.
endwhile.
endif.
I send several copies of my report to the spool. This is why I'm using the parameters tdnewid and tdfinal.
It works fine in case I don't the parameter no_dialog but I need it because otherwise the spool dialog appears for each copy.
The name of my output device is PRUEBA but, I don't know exactly which parameter I must use.
Can anybody help me?
Thanks in advance.
Regards.
‎2012 Nov 08 9:43 AM
Hi David,
Set USER_SETTINGS = space while calling smartform.
_control_param-no_dialog = 'X'.
_output_options-tddest = 'PRUEBA'.
CALL FUNCTION _fm_name
EXPORTING
control_parameters = _control_param
output_options = _output_options
USER_SETTINGS = space
i_data = _label_data
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
Also this topic maybe helps you
‎2012 Nov 08 9:43 AM
Hi David,
Set USER_SETTINGS = space while calling smartform.
_control_param-no_dialog = 'X'.
_output_options-tddest = 'PRUEBA'.
CALL FUNCTION _fm_name
EXPORTING
control_parameters = _control_param
output_options = _output_options
USER_SETTINGS = space
i_data = _label_data
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
Also this topic maybe helps you
‎2012 Nov 08 10:12 AM
Hi Basar.
writing your code it doesn't return any error but the spool doesn't start and, of course, the report isn't printed:
CALL FUNCTION v_fm
EXPORTING
control_parameters = gs_control_parameters
output_options = gs_output_options
* USER_SETTINGS = space
zmatnr = pmat-low
zlot = plot-low
zfem = pfemb
zpes = ppeso.
Any suggestion?
Thanks for your help.
‎2012 Nov 08 11:06 AM
Did you set tdimmed of output options?
_output_options-tddelete = 'X'. "Delete after print
_output_options-tdimmed = 'X'. "Print immediately
‎2012 Nov 08 11:44 AM
Ok, now it works well whenever I go out from the execution and run it again.
I mean, the first time it works well and the second time that I want to print without going out from the execution, it seems that lose the parameters and the device output is not "PRUEBA" again.
Is there any way to keep the values of the parameters until I finish the execution?
It's important for me because it's program which must be always opened in a pc and is constantly used.
Thanks.
‎2012 Nov 08 1:00 PM
Hi David,
Did you check this link? http://scn.sap.com/message/13633747
Modify your code according to solution of link.
‎2012 Nov 08 3:51 PM
Hi Basar,
I've seen the link and I've tried the following in the code though I get an error in fact, it seems that the spool is hang:
gs_control_parameters-no_open = 'X'.
gs_control_parameters-no_close = 'X'.
gs_control_parameters-no_dialog = 'X'.
gs_output_options-tddest = 'PRUEBA'. "En el futuro deberá ser LOCL
gs_output_options-tddelete = 'X'. "Delete after print
gs_output_options-tdimmed = 'X'. "Print immediately
break droig.
CALL FUNCTION 'SSF_OPEN'
EXPORTING
control_parameters = gs_control_parameters
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
..........................
..........................
CALL FUNCTION v_fm
EXPORTING
control_parameters = gs_control_parameters
output_options = gs_output_options
USER_SETTINGS = space
zmatnr = pmat-low
zlot = plot-low
zfem = pfemb
zpes = ppeso
znroetq = pnroetq.
..........................
..........................
CALL FUNCTION 'SSF_CLOSE'
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
OTHERS = 4.
Any suggestion would be welcome.
Thanks a lot for your patience.
‎2012 Nov 08 4:08 PM
Hi David,
Call SSF_CLOSE before SSF_OPEN as below.
gs_control_parameters-no_open = 'X'.
gs_control_parameters-no_close = 'X'.
gs_control_parameters-no_dialog = 'X'.
gs_output_options-tddest = 'PRUEBA'. "En el futuro deberá ser LOCL
gs_output_options-tddelete = 'X'. "Delete after print
gs_output_options-tdimmed = 'X'. "Print immediately
CALL FUNCTION 'SSF_CLOSE'
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
OTHERS = 4.
CALL FUNCTION 'SSF_OPEN'
EXPORTING
control_parameters = gs_control_parameters
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
..........................
..........................
CALL FUNCTION v_fm
EXPORTING
control_parameters = gs_control_parameters
output_options = gs_output_options
USER_SETTINGS = space
zmatnr = pmat-low
zlot = plot-low
zfem = pfemb
zpes = ppeso
znroetq = pnroetq.
..........................
..........................
CALL FUNCTION 'SSF_CLOSE'
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
OTHERS = 4.
‎2012 Nov 08 4:44 PM
Basr,
it doesn't work.
I've change the position of SSF_OPEN and SSF_CLOSE to see if it could be the problem but the same:
gs_control_parameters-no_dialog = 'X'.
gs_control_parameters-no_open = 'X'.
gs_control_parameters-no_close = 'X'.
CALL FUNCTION 'SSF_CLOSE'
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
OTHERS = 4.
gs_output_options-tddest = 'PRUEBA'. "En el futuro deberá ser LOCL
gs_output_options-tddelete = 'X'. "Delete after print
gs_output_options-tdimmed = 'X'. "Print immediately
CALL FUNCTION 'SSF_OPEN'
EXPORTING
control_parameters = gs_control_parameters
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
................
.................
‎2012 Nov 09 12:09 PM
Hello Basar,
we finally got. I've only made a small modification:
gs_control_parameters-no_dialog = 'X'.
gs_output_options-tddest = 'PRUEBA'. "En el futuro deberá ser LOCL
gs_output_options-tddelete = 'X'. "Delete after print
gs_output_options-tdimmed = 'X'. "Print immediately
i = pnet.
WHILE i > 0.
IF i = pnet.
gs_output_options-tdnewid = 'X'.
ELSE.
gs_output_options-tdnewid = space.
ENDIF.
CALL FUNCTION v_fm
EXPORTING
control_parameters = gs_control_parameters
output_options = gs_output_options
USER_SETTINGS = space
zmatnr = pmat-low
zlot = plot-low
zfem = pfemb
zpes = ppeso
znroetq = pnroetq.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
i = i - 1.
endwhile.
Thanks a lot for your help.
Regards.
‎2012 Nov 09 12:33 PM