on 01-15-2007 12:51 PM
Hi experts!
My requirement is that I want just to preview a form from a printing program without any dialog. But the code below doesn't work.
DATA: gt_control TYPE ssfctrlop,
gt_output TYPE ssfcompop.
gt_control-preview = 'X'.
gt_control-no_open = 'X'.
gt_control-no_close = 'X'.
gt_control-no_dialog = 'X'.
gt_control-device = 'PRINTER'.
gt_output-tddest = 'LP01'.
gt_output-tdnoprint = 'X'.
CALL FUNCTION gv_func_name
EXPORTING
in_rec_per_page_amount = pa_recno
in_org_stext = pa_group
in_specname = pa_fname
in_spec_short = pa_fcode
in_semestr = pa_sem
in_disc_stext = pa_subj
control_parameters = gt_control
output_options = gt_output
TABLES
in_students_tab = gt_smart
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
What is wrong in my code?
Regards,
Pavel Aleshko
ur code looks like when u execute it is printing the form instead of preview.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This was exactly the job i did today . this is my code , and its working . i used a check box for user to view print preview or no .
PARAMETERS : p_prn TYPE SSFCOMPOP-tddest DEFAULT 'LOCL'.
PARAMETERS : R_PR1 AS CHECKBOX DEFAULT 'X'.
IF INT_SALARY[] IS NOT INITIAL.
IF R_PR1 IS INITIAL.
control_parameters-NO_DIALOG = 'X'.
Control_parameters-PREVIEW = 'X'.
control_parameters-no_open = 'X'.
control_parameters-no_close = 'X'.
output_options-tdnoprint = 'X'.
output_options-tdnoarch = 'X'.
output_options-tddelete = 'X'.
output_options-tddest = p_prn.
output_options-tdnewid = ''.
output_options-tdimmed = ' '.
"g_output_options-tdcopies = 1.
output_options-tddataset = sy-repid.
output_options-tddelete = ' '.
OUTPUT_OPTIONS-TDTITLE = 'Salary Change Form'.
CALL FUNCTION 'SSF_OPEN'
EXPORTING
USER_SETTINGS = ' '
OUTPUT_OPTIONS = OUTPUT_OPTIONS
CONTROL_PARAMETERS = control_parameters.
IF SY-SUBRC <> 0.
"* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
"* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
*----
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
FORMNAME = 'ZHR_SCR_L03'
IMPORTING
FM_NAME = WF_FNAME
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 WF_FNAME
EXPORTING
control_parameters = control_parameters
OUTPUT_OPTIONS = OUTPUT_OPTIONS
TABLES
INT_SALARY = INT_SALARY[]
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.
*----
CHECK R_PR1 IS INITIAL.
CALL FUNCTION 'SSF_CLOSE'
..
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*----
ELSE.
MESSAGE S082(Z1)."'No salary has been Changed during the selected period' TYPE 'S'.
ENDIF.
Message was edited by:
Khaleel S.Mohammed
Message was edited by:
Khaleel S.Mohammed
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Pavel ,
in your first code add this line in your function module , your problem will be solved . you don't need SSF_OPEN - CLOSE functions .
*----
user_settings = space
*----
CALL FUNCTION gv_func_name
EXPORTING
in_rec_per_page_amount = pa_recno
in_org_stext = pa_group
in_specname = pa_fname
in_spec_short = pa_fcode
in_semestr = pa_sem
in_disc_stext = pa_subj
control_parameters = gt_control
output_options = gt_output
<b>user_settings = space</b>
TABLES
in_students_tab = gt_smart
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi Pavel i done the same in my object.. it ownt display the Dialog
<b>Modify the OUTPUT_OPTIONS( gt_output IN YOUR CALL</b>)
THIS IS MY CODE BEFORE CLLING THE SMART FORM YOU HAVE TO DO THIS
*********************
ST_CONTROL_PARAMETERS-DEVICE = C_PRINTER. "Output device
<b> ST_CONTROL_PARAMETERS-NO_DIALOG = C_X. "SAP Smart Forms: General Indicator</b> ST_OUTPUT_OPTIONS-TDTITLE = text-011. "Free goods credit notes'
ST_OUTPUT_OPTIONS-TDNEWID = C_X. "create new spool dataset
ST_OUTPUT_OPTIONS-TDCOPIES = C_N_1. "one copy Commented by SM0001
ST_OUTPUT_OPTIONS-TDDEST = P_PRNTR. "name of printer
ST_OUTPUT_OPTIONS-TDNOPREV = SPACE. "no preview
ST_OUTPUT_OPTIONS-TDCOVER = SPACE. "no cover page
ST_OUTPUT_OPTIONS-TDDATASET = P_PRNTR. "dataset name
ST_OUTPUT_OPTIONS-TDSUFFIX2 = SPACE. "name of report variant
ST_OUTPUT_OPTIONS-TDIMMED = C_Y. "print immediately? Commented by SM0001
ST_OUTPUT_OPTIONS-TDDELETE = SPACE. "do not delete after print
*****************Insert by SM0001 on 17/10/2006
if P_TMOD = C_2.
ST_OUTPUT_OPTIONS-TDARMOD = C_3.
elseif p_tmod = C_1.
ST_OUTPUT_OPTIONS-TDCOPIES = C_N_1. "one copy
ST_OUTPUT_OPTIONS-TDIMMED = C_Y. "print immediately?
elseif p_tmod = c_3.
ST_OUTPUT_OPTIONS-TDARMOD = C_3.
ST_OUTPUT_OPTIONS-TDCOPIES = C_N_1. "one copy
ST_OUTPUT_OPTIONS-TDIMMED = C_Y. "print immediately?
endif.
********************End of insertion By SM0001
Please Close this thread.. when u r problem is solved
Reward if Helpful
Regards
Naresh Reddy K
Message was edited by:
Naresh Reddy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi! I find a solution to my problem! Here is the code that allows me to run the preview of the SF without a dialog.
DATA: gt_control TYPE ssfctrlop,
gt_output TYPE ssfcompop,
gs_input TYPE ssfcompin.
gs_input-device = 'PRINTER'.
gs_input-tdpreview = 'X'.
gs_input-tddest = 'LP01'.
gs_input-dialog = ' '.
CALL FUNCTION 'SSF_OPEN'
EXPORTING
input = gs_input
user_settings = 'X'
EXCEPTIONS
error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
* gt_output-tdnewid = 'X'.
* gt_output-tddest = 'LP01'.
gt_control-preview = 'X'.
gt_control-no_dialog = 'X'.
gt_control-no_open = 'X'.
gt_control-no_close = 'X'.
CALL FUNCTION gv_func_name
EXPORTING
order = pa_order
control_parameters = gt_control
output_options = gt_output
user_settings = space
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
IF sy-subrc <> 0.
WRITE: 'Sy-subrc:',sy-subrc,
'Error occurred while calling smart form FM!'.
ENDIF.
CALL FUNCTION 'SSF_CLOSE'.
I awarded each of you 2 points. But I have some questions:
<b>1)</b> Why do we have to use ssf_open/ssf_close instead of passing the SAME parameters to SmartForm FM?
<b>2)</b> What is the use of User_settings parameter?
<b>3)</b> What is the use of no_open/no_close parameters?
Thanks!
Advanced points will be awarded for helpful answers!
You do not need the SSF_Open/Close if you leave out the parameters
gt_control-no_open = 'X'.
gt_control-no_close = 'X'.
Sample code of how a simple call to a smartform looks like
DATA: gt_control TYPE ssfctrlop,
gt_output TYPE ssfcompop,
gs_input TYPE ssfcompin.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = lf_formname
IMPORTING
fm_name = gv_func_name
EXCEPTIONS
no_form = 1
no_function_module = 2
OTHERS = 3.
gt_output-tdnewid = 'X'.
gt_output-tddest = 'LP01'.
gt_control-preview = 'X'.
gt_control-no_dialog = 'X'.
CALL FUNCTION gv_func_name
EXPORTING
order = pa_order
control_parameters = gt_control
output_options = gt_output
user_settings = space
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
IF sy-subrc <> 0.
WRITE: 'Sy-subrc:',sy-subrc,
'Error occurred while calling smart form FM!'.
ENDIF.
Kind regards,
Marius
Some answers to your Q:
1) Why do we have to use ssf_open/ssf_close instead of passing the SAME parameters to SmartForm FM?
This way you can add more than one form to a single spool request to print all at the same time.
2) What is the use of User_settings parameter?
Not sure about this, would also like to know.
3) What is the use of no_open/no_close parameters?
Follows on with you first Question.
If the parameter is set ('X'), SAP Smart Forms copies the user defaults for the Spool Control, which you set under System®User Profile ®Own Data (Output Device, Print Immediately, Delete after Output). If it is not set, SAP Smart Forms instead evaluates the following parameters of the structure for the output options ( SSFCOMOP 😞
Printer settings ( TDDEST , TDPRINTER , RQPOSNAME )
TDIMMED (Print immediately)
TDDELETE (Delete after output)
hi,
u have checked the preview option in the control parameters.
that is the only error.
so define it like this
DATA: gt_control TYPE ssfctrlop,
gt_output TYPE ssfcompop.
gt_control-preview = ''.
gt_control-no_open = 'X'.
gt_control-no_close = 'X'.
gt_control-no_dialog = 'X'.
gt_control-device = 'PRINTER'.
gt_output-tddest = 'LP01'.
gt_output-tdnoprint = 'X'.
Message was edited by:
Durgaprasad Kare
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
95 | |
11 | |
11 | |
10 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.