2014 Apr 17 9:52 AM
Hi all,
I am new to smartforms. The smartform is to be converted to PDF and sent as an attachment via email. When I'm executing it from VA03 through the output type (Transmission medium 5), after giving the output device name I can see the smartform output. When I'm pressing the back button
"OTF end command // missing in OTF data" this message is displayed. The mail is coming though but when I'm trying to open the PDF attchment, Adobe reader is showing the following error message
"Adobe Reader could not open 'file.pdf'beacuse it is either not a supported file type or because the file has been damaged (for example, it was sent as an email attachment and wasn't correctly decoded)."
Following is the section of the code for PDF attachment
* Attachment (pdf-Attachment)
i_objpack_temp-transf_bin = 'X'.
i_objpack_temp-head_start = 1.
i_objpack_temp-head_num = 0.
i_objpack_temp-body_start = 1.
DESCRIBE TABLE i_objbin LINES v_lines_bin.
READ TABLE i_objbin INTO i_objbin_temp INDEX v_lines_bin.
i_objpack_temp-doc_size = v_lines_bin * 255 .
i_objpack_temp-body_num = v_lines_bin.
i_objpack_temp-doc_type = 'PDF'.
i_objpack_temp-obj_name = 'SMART'.
i_objpack_temp-obj_descr = 'XYZ'.
APPEND i_objpack_temp TO i_objpack.
CLEAR i_reclist_temp.
Plz suggest what is wrong? Any suggestion will be of great help. Points will be given.
Thanks in advance.
2014 Apr 17 11:30 AM
Hi,
1. On calling the smart form as below, the st_job_output_info-otfdata should be filled.
*...........................CALL SMARTFORM............................*
CALL FUNCTION v_fm_name
EXPORTING
control_parameters = st_control_parameters
output_options = st_output_options
IMPORTING
document_output_info = st_document_output_info
job_output_info = st_job_output_info
job_output_options = st_job_output_options
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
2. For PDF conversion as below st_job_output_info-otfdata should not be initial. if st_job_output_info-otfdata is empty then the following error will be thrown ""OTF end command // missing in OTF data". Hence in your case please check otfdata is filled after calling the smartform.
*.........................CONVERT TO OTF TO PDF.......................*
CALL FUNCTION 'CONVERT_OTF_2_PDF'
IMPORTING
bin_filesize = v_bin_filesize
TABLES
otf = st_job_output_info-otfdata
doctab_archive = it_docs
lines = it_lines
EXCEPTIONS
err_conv_not_possible = 1
err_otf_mc_noendmarker = 2
OTHERS
2014 Apr 17 1:32 PM
Hi Priya,
Pass this parameter as below:
i_objpack_temp-doc_size = (v_lines_bin - 1 ) * 255 + strlen( i_objbin ).
Thanks,
Anil
2014 Apr 17 1:39 PM
Sample Codings Please Check it.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = 'YDEMO'
* VARIANT = ' '
* DIRECT_CALL = ' '
IMPORTING
FM_NAME = fnam
EXCEPTIONS
NO_FORM = 1
NO_FUNCTION_MODULE = 2
OTHERS = 3
.
CALL FUNCTION fnam "'/1BCDWB/SF00000020'
EXPORTING
* ARCHIVE_INDEX =
* ARCHIVE_INDEX_TAB =
* ARCHIVE_PARAMETERS =
CONTROL_PARAMETERS = lv_control_parameters
* MAIL_APPL_OBJ =
* MAIL_RECIPIENT =
* MAIL_SENDER =
OUTPUT_OPTIONS = lv_output_options
USER_SETTINGS = ''
po = p_po
IMPORTING
DOCUMENT_OUTPUT_INFO = doc_info
JOB_OUTPUT_INFO = job_info
JOB_OUTPUT_OPTIONS = op_option
* 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.
if job_info-spoolids is NOT INITIAL.
READ TABLE job_info-spoolids INDEX 1 INTO wa .
MOVE WA TO SPOOL.
CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = SPOOL
NO_DIALOG = ' '
* DST_DEVICE =
* PDF_DESTINATION =
* NO_BACKGROUND =
* IMPORTING
* PDF_BYTECOUNT =
* PDF_SPOOLID =
* OTF_PAGECOUNT =
* BTC_JOBNAME =
* BTC_JOBCOUNT =
* BIN_FILE =
TABLES
PDF = PDF
* EXCEPTIONS
* ERR_NO_OTF_SPOOLJOB = 1
* ERR_NO_SPOOLJOB = 2
* ERR_NO_PERMISSION = 3
* ERR_CONV_NOT_POSSIBLE = 4
* ERR_BAD_DSTDEVICE = 5
* USER_CANCELLED = 6
* ERR_SPOOLERROR = 7
* ERR_TEMSEERROR = 8
* ERR_BTCJOB_OPEN_FAILED = 9
* ERR_BTCJOB_SUBMIT_FAILED = 10
* ERR_BTCJOB_CLOSE_FAILED = 11
* OTHERS = 12
.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
2014 Apr 29 9:03 AM
Hi Anand,
What value is to be there in st_job_output_info-otfdata?? By debugging I'm getting st_job_output_info as a deep structure. In which otfdata is a standard table which is blank. And I'm still getting the "OTF end command // missing in OTF data" message.
Please suggest what I need to do. Unable to find the solution.
Regards,
Debapriya
2014 Apr 29 9:42 AM
You MUST explicitly ask for an OTF generation if you want to get it in returned parameter.
control_parameters -getotf = 'X'.
Regards,
Raymond
2014 Apr 29 3:13 PM
Hi Raymond,
Can you please elaborate a bit? By the way the statement that you have shown is used in the program.
Regards,
Debapriya
2014 Apr 30 1:36 PM
2023 Mar 22 8:12 AM
Hi bebapriya
How did youvresolve the issue, i am also facing the same issue can you help me in this.
Thanks
2024 Jul 15 6:29 PM
Could you indicate how you resolved it? I also have the same problem