‎2007 Oct 10 11:10 AM
Hi all,
I have used smarform to send the output of Order Confirmation in PDF format to customer's external mail id. The program is working fine and sending mail to customer's mail id. But the problem is when I am trying to open the PDF file, I am getting the error. The error says ''An unrecognized token 'xxx.xx' was found", where xxx.xx is some number.
I have searched the forum, got some link to resolve that but didnt get the success. To send the mail, I have used the program which is generally used to send the mail. Like me some more users are looking for the solution for this error.
Using SAP4.7.
Helpful Ans will be rewarded
Thanks in Adv.
Jigar
‎2007 Oct 10 11:17 AM
SX_OBJECT_CONVERT_OTF_PDF Please use this function module to solve the problem......
Use this in following way....
Please note the following:
1. Get the FM name of the SSF:
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = 'SSF'"Name of the SSF
IMPORTING
fm_name = fmname "Variable
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.
2. Get the Output of the Form....
DATA :l_t_job_output TYPE ssfcrescl OCCURS 0 WITH HEADER LINE.
DATA :l_t_out LIKE ssfcompop OCCURS 0 WITH HEADER LINE.
DATA :l_t_control LIKE ssfctrlop OCCURS 0 WITH HEADER LINE.
l_t_out-tddest = 'LOCL'.
APPEND l_t_out.
l_t_control-no_dialog = 'X'.
l_t_control-getotf = 'X'.
l_t_control-no_close = space.
APPEND l_t_control.
CALL FUNCTION fmname
EXPORTING
control_parameters = l_t_control
output_options = l_t_out
IMPORTING
job_output_info = l_t_job_output
TABLES
*
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.
3. Convert the OTF to PDF format...
DATA :l_t_pdfdata_tab LIKE tline OCCURS 200.
CALL FUNCTION 'CONVERT_OTF_2_PDF'
EXPORTING
use_otf_mc_cmd = 'X'
IMPORTING
bin_filesize = l_filesize_deck "Variable
TABLES
otf = l_t_job_output-otfdata
doctab_archive = l_t_docs " Variable
lines = l_t_pdfdata_tab
EXCEPTIONS
err_conv_not_possible = 1
err_otf_mc_noendmarker = 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.
4. Download the PDF data...
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
bin_filesize = l_filesize "Variable
filename = 'C:\temp.pdf'
filetype = 'BIN"
mode = ' '
IMPORTING
filelength = l_filesize "Variable
TABLES
data_tab = l_t_pdfdata_tab
EXCEPTIONS
file_open_error = 1
file_write_error = 2
invalid_filesize = 3
invalid_type = 4
no_batch = 5
unknown_error = 6
invalid_table_width = 7
gui_refuse_filetransfer = 8
customer_error = 9
OTHERS = 10.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
5. View the Doc...
CALL FUNCTION 'WS_EXECUTE'
EXPORTING
document = 'X'
cd = 'C:\'
program = 'C:\temp.pdf'
EXCEPTIONS
frontend_error = 1
no_batch = 2
prog_not_found = 3
illegal_option = 4
gui_refuse_execute = 5
OTHERS = 6.
Note: The Exceptions in any FM are to be uncommented to catch the errer. Else SAP may trigger a dump.
*********************
call function 'SX_OBJECT_CONVERT_OTF_PDF'
exporting
format_src = 'OTF'
format_dst = 'PDF'
devtype = 'PRINTER'
FUNCPARA =
len_in = '1234'
IMPORTING
LEN_OUT =
tables
content_in = objbin
content_out = objpdf
EXCEPTIONS
ERR_CONV_FAILED = 1
OTHERS = 2.
‎2007 Oct 10 11:17 AM
SX_OBJECT_CONVERT_OTF_PDF Please use this function module to solve the problem......
Use this in following way....
Please note the following:
1. Get the FM name of the SSF:
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = 'SSF'"Name of the SSF
IMPORTING
fm_name = fmname "Variable
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.
2. Get the Output of the Form....
DATA :l_t_job_output TYPE ssfcrescl OCCURS 0 WITH HEADER LINE.
DATA :l_t_out LIKE ssfcompop OCCURS 0 WITH HEADER LINE.
DATA :l_t_control LIKE ssfctrlop OCCURS 0 WITH HEADER LINE.
l_t_out-tddest = 'LOCL'.
APPEND l_t_out.
l_t_control-no_dialog = 'X'.
l_t_control-getotf = 'X'.
l_t_control-no_close = space.
APPEND l_t_control.
CALL FUNCTION fmname
EXPORTING
control_parameters = l_t_control
output_options = l_t_out
IMPORTING
job_output_info = l_t_job_output
TABLES
*
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.
3. Convert the OTF to PDF format...
DATA :l_t_pdfdata_tab LIKE tline OCCURS 200.
CALL FUNCTION 'CONVERT_OTF_2_PDF'
EXPORTING
use_otf_mc_cmd = 'X'
IMPORTING
bin_filesize = l_filesize_deck "Variable
TABLES
otf = l_t_job_output-otfdata
doctab_archive = l_t_docs " Variable
lines = l_t_pdfdata_tab
EXCEPTIONS
err_conv_not_possible = 1
err_otf_mc_noendmarker = 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.
4. Download the PDF data...
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
bin_filesize = l_filesize "Variable
filename = 'C:\temp.pdf'
filetype = 'BIN"
mode = ' '
IMPORTING
filelength = l_filesize "Variable
TABLES
data_tab = l_t_pdfdata_tab
EXCEPTIONS
file_open_error = 1
file_write_error = 2
invalid_filesize = 3
invalid_type = 4
no_batch = 5
unknown_error = 6
invalid_table_width = 7
gui_refuse_filetransfer = 8
customer_error = 9
OTHERS = 10.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
5. View the Doc...
CALL FUNCTION 'WS_EXECUTE'
EXPORTING
document = 'X'
cd = 'C:\'
program = 'C:\temp.pdf'
EXCEPTIONS
frontend_error = 1
no_batch = 2
prog_not_found = 3
illegal_option = 4
gui_refuse_execute = 5
OTHERS = 6.
Note: The Exceptions in any FM are to be uncommented to catch the errer. Else SAP may trigger a dump.
*********************
call function 'SX_OBJECT_CONVERT_OTF_PDF'
exporting
format_src = 'OTF'
format_dst = 'PDF'
devtype = 'PRINTER'
FUNCPARA =
len_in = '1234'
IMPORTING
LEN_OUT =
tables
content_in = objbin
content_out = objpdf
EXCEPTIONS
ERR_CONV_FAILED = 1
OTHERS = 2.
‎2007 Oct 10 12:07 PM
Hi vasu,
We were using the FM 'CONVERT_OTF', but we instead used 'CONVERT_OTF_2_PDF' WHICH IS SUGGESTED By you.
It is working fine when we download the form but when we send mail, it is giving an error "Token BT70.85 not found" . Can you help me???
For sending mail i am using 'SO_NEW_DOCUMENT_ATT_SEND_API1' function module.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
DOCUMENT_DATA = WA_DOCUMENT
PUT_IN_OUTBOX = 'X'
COMMIT_WORK = 'X'
TABLES
PACKING_LIST = IT_PACKING
CONTENTS_BIN = IT_CONTENTS_BIN
CONTENTS_TXT = IT_CONTENTS_TXT
RECEIVERS = IT_RECEIVERS
EXCEPTIONS
TOO_MANY_RECEIVERS = 1
DOCUMENT_NOT_SENT = 2
DOCUMENT_TYPE_NOT_EXIST = 3
OPERATION_NO_AUTHORIZATION = 4
PARAMETER_ERROR = 5
X_ERROR = 6
ENQUEUE_ERROR = 7
OTHERS = 8.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Please reply ASAP. Thanks
Jigar
‎2007 Oct 10 11:18 AM
Hi Jigar,
Once u get the PDF data in the internal table, u need to translate symbol '<b>~</b>' to space before storing all the data in the internal table for MAILBIN. (Interface of Fm SO_NEW_DOCUMENT_ATT_SEND_API1).
Please Check.
Award points if found useful.