Hi Meriem,
Debug your report and check if the parameter are giving correct values, you can have a look at the sample code below :
DATA lv_smartform TYPE rs38l_fnam.
DATA ls_ssfctrlop TYPE ssfctrlop.
DATA ls_output_options TYPE ssfcompop.
DATA ls_job_output_info TYPE ssfcrescl.
DATA lt_lines TYPE STANDARD TABLE OF tline.
DATA lv_bin_filesize TYPE i.
DATA lv_pdf_xstring TYPE xstring.
* -- Get the name of the smartform function module
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = 'ZMY_SMARTFORM'
IMPORTING
fm_name = lv_smartform.
* -- Call the smartform
ls_ssfctrlop-no_dialog = abap_true.
ls_ssfctrlop-getotf = abap_true.
ls_output_options-tdprinter = 'PDF1'.
CALL FUNCTION lv_smartform
EXPORTING
control_parameters = ls_ssfctrlop
output_options = ls_output_options
custom_input = ls_your_custom_smartform_input
IMPORTING
job_output_info = ls_job_output_info
EXCEPTIONS
OTHERS = 0.
* ---Convert the OTF data to xstring
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
IMPORTING
bin_filesize = lv_bin_filesize
bin_file = lv_pdf_xstring
TABLES
otf = ls_job_output_info-otfdata[]
lines = lt_lines
EXCEPTIONS
OTHERS = 0.
"---Attach file to response
cl_wd_runtime_services=>attach_file_to_response(
i_filename = 'mypdf.pdf'
i_content = lv_pdf_xstring
i_mime_type = 'application/pdf'
).
also check the note given below :
1296758 - Sending purchase order attachments via mail
Please rewards points if this post is helpul.
Thanks,
AkkI