on 02-15-2007 3:53 AM
Hello Expert,
I created a program to covert a form to pdf format, then, send it to SAPoffice (SBWP) as an attachment successfully. But I cannot open the pdf attachment. I don't know the reason. Could you please give me some suggestion?
use function module 'CONVERT_OTF_2_PDF' to convert pdf format
use function module SO_NEW_DOCUMENT_ATT_SEND_API1 to send email.
points will be assigned for Helpful suggestion.
Thank you.
Hello Mr. Humerah md, could you please tell me what the problem is?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks.
I have tried to download it into my local computer, the downloaded pdf file can be open correctly. So it's the problem in my program.
Below is my program, thanks a lot.
*----
DATA: itcpo LIKE itcpo,
tab_lines LIKE sy-tabix.
Variables for EMAIL functionality
DATA: maildata LIKE sodocchgi1.
DATA: mailpack LIKE sopcklsti1 OCCURS 2 WITH HEADER LINE.
DATA: mailhead LIKE solisti1 OCCURS 1 WITH HEADER LINE.
DATA: mailbin LIKE solisti1 OCCURS 10 WITH HEADER LINE.
DATA: mailtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE.
DATA: mailrec LIKE somlrec90 OCCURS 0 WITH HEADER LINE.
DATA: solisti1 LIKE solisti1 OCCURS 0 WITH HEADER LINE.
PERFORM send_form_via_email.
************************************************************************
FORM SEND_FORM_VIA_EMAIL *
************************************************************************
FORM send_form_via_email.
CLEAR: maildata, mailtxt, mailbin, mailpack, mailhead, mailrec.
REFRESH: mailtxt, mailbin, mailpack, mailhead, mailrec.
Creation of the document to be sent File Name
maildata-obj_name = 'TEST'.
Mail Subject
maildata-obj_descr = 'test_1234567879'.
Mail Contents
mailtxt-line = 'Here is your file'.
APPEND mailtxt.
Prepare Packing List
*----
PERFORM prepare_packing_list.
*----
CLEAR: mailpack, mailbin, mailhead.
REFRESH: mailpack, mailbin, mailhead.
DESCRIBE TABLE mailtxt LINES tab_lines.
READ TABLE mailtxt INDEX tab_lines.
maildata-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( mailtxt ).
Creation of the entry for the compressed document
CLEAR mailpack-transf_bin.
mailpack-head_start = 1.
mailpack-head_num = 0.
mailpack-body_start = 1.
mailpack-body_num = tab_lines.
mailpack-doc_type = 'PDF'.
APPEND mailpack.
*----
PERFORM get_otf_code.
*----
DATA: BEGIN OF otf OCCURS 0.
INCLUDE STRUCTURE itcoo .
DATA: END OF otf.
DATA: itcpo LIKE itcpo.
DATA: itcpp LIKE itcpp.
CLEAR itcpo.
itcpo-tdgetotf = 'X'.
Start writing OTF code
CALL FUNCTION 'OPEN_FORM'
EXPORTING
form = 'ZTEST_FORM'
language = sy-langu
options = itcpo
dialog = ' '
EXCEPTIONS
OTHERS = 1.
CALL FUNCTION 'START_FORM'
EXCEPTIONS
error_message = 01
OTHERS = 02.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
window = 'MAIN'
EXCEPTIONS
error_message = 01
OTHERS = 02.
Close up Form and get OTF code
CALL FUNCTION 'END_FORM'
EXCEPTIONS
error_message = 01
OTHERS = 02.
MOVE-CORRESPONDING itcpo TO itcpp.
CALL FUNCTION 'CLOSE_FORM'
IMPORTING
result = itcpp
TABLES
otfdata = otf
EXCEPTIONS
OTHERS = 1.
DATA: i_tline TYPE TABLE OF tline WITH HEADER LINE,
v_len_in LIKE sood-objlen.
DATA doctab_archive LIKE docs OCCURS 10.
CALL FUNCTION 'CONVERT_OTF_2_PDF'
EXPORTING
USE_OTF_MC_CMD = 'X'
ARCHIVE_INDEX =
IMPORTING
BIN_FILESIZE =
TABLES
otf = otf
doctab_archive = doctab_archive
lines = i_tline
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.
CLEAR solisti1. REFRESH solisti1.
LOOP AT i_tline.
solisti1-line = i_tline.
APPEND solisti1.
ENDLOOP.
LOOP AT solisti1. "solisti1.
MOVE-CORRESPONDING solisti1 TO mailbin.
APPEND mailbin.
ENDLOOP.
DESCRIBE TABLE mailbin LINES tab_lines.
mailhead = 'TEST.PDF'.
APPEND mailhead.
Creation of the entry for the compressed attachment
mailpack-transf_bin = 'X'.
mailpack-head_start = 1.
mailpack-head_num = 1.
mailpack-body_start = 1.
mailpack-body_num = tab_lines.
mailpack-doc_type = 'PDF'.
mailpack-obj_name = 'TEST'.
mailpack-obj_descr = 'Subject'.
mailpack-doc_size = tab_lines * 255.
APPEND mailpack.
*----
Set recipient - email address here!!!
mailrec-receiver = 'FU.Q.HUANG'. "'engle2_@126.com'.
mailrec-rec_type = 'B'. "'U'.
APPEND mailrec.
Sending the document
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = maildata
PUT_IN_OUTBOX = ' '
IMPORTING
SENT_TO_ALL =
NEW_OBJECT_ID =
TABLES
packing_list = mailpack
OBJECT_HEADER =
contents_bin = mailbin
contents_txt = mailtxt
CONTENTS_HEX = mailbin
OBJECT_PARA =
OBJECT_PARB =
receivers = mailrec
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.
ENDFORM.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi,
try to download it into PDF format using the program RSTXPDFT4and then try to open it.If it gets open then there is problem in ur program and if ur unable to open then the problem is in Adobe reader.plz do reward points if it is useful.If there is problem in ur program then let me now.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
Thanks for your reply. But I'm sure Adorb reader has been installed in my computer.
I cannot open the pdf attachment in SAPoffice (Transaction: SBWP)
The error hint is:There was an error opening this document. There was a problem reading this document(110).
Besides, the size of pdf attachment was always 1 K.
It must be some problem in my program.
Could anybody help me?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi ...
I had gone through the qurries made by you. First let me know either Acrobat reader is installed in your system or not in which u want to open the PDF file. If not Pls download then open. Let me inform... If useful don't forget to award a point.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
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.