2010 Dec 03 6:22 AM
Hi Experts,
I am using FM 'SO_NEW_DOCUMENT_ATT_SEND_API1' to send PDF attachment to external mail id.
The program is sending file to the recipients with the attachment but while trying to open the attachment getting an error from ADOBE side
like ''Adobe Reader could not open ABC.PDF because it is either not a supported file type or because the file has been damaged (for example, it is sent as an email attachment and wasn't correctly decoded)."
Please let me know how to resolve this.
Following is the code snippet:
Call the FM to post the message to SAPMAIL
call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
exporting
document_data = gd_doc_data
put_in_outbox = ' '
commit_work = 'X'
importing
sent_to_all = gd_sent_all
tables
packing_list = it_packing_list
contents_txt = it_message
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.
Hi Experts,
I am using FM 'SO_NEW_DOCUMENT_ATT_SEND_API1' to send PDF attachment to external mail id.
The program is sending file to the recipients with the attachment but while trying to open the attachment getting an error from ADOBE side
like ''Adobe Reader could not open ABC.PDF because it is either not a supported file type or because the file has been damaged (for example, it is sent as an email attachment and wasn't correctly decoded)."
Please let me know how to resolve this.
Following is the code snippet:
Call the FM to post the message to SAPMAIL
call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
exporting
document_data = gd_doc_data
put_in_outbox = ' '
commit_work = 'X'
importing
sent_to_all = gd_sent_all
tables
packing_list = it_packing_list
contents_txt = it_message
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.
2010 Dec 03 6:41 AM
Looks like adobe error. Can you open other adobe files in your system?
Also, how are you converting your file to pdf format.
If you are converting spool to pdf, use SPO_RETURN_SPOOLJOB to get the OTF data from spool into an
internal table.
Assign Desired_type to 'PDF' and compress the internal table (TABLE_COMPRESS) and decompress (TABLE_DECOMPRESS) it again (change of formats)
Move the result to objbin in SO_NEW_DOCUMENT_ATT_SEND_API1.
2010 Dec 03 7:17 AM
Hi Anirban,
Please refer the below code I also faced same problem when iam using Function Module so i go to OOPS and now problem solved
try.
* -------- create persistent send request ------------------------
go_send_request = cl_bcs=>create_persistent( ).
* -------- create and set document -------------------------------
GV_pdf_content = cl_document_bcs=>xstring_to_solix( GV_pdf_xstring ).
Go_document = cl_document_bcs=>create_document(
i_type = 'PDF'
i_hex = GV_pdf_content
i_length = Gv_pdf_size
i_subject = 'Invoice for NA/CA' ). "#EC NOTEXT
* add document object to send request
GO_send_request->set_document( GO_document ).
* --------- add recipient (e-mail address) -----------------------
* create recipient object
go_recipient = cl_cam_address_bcs=>create_internet_address( LV_EMAIL )."EMAIL ID
* go_recipient = cl_cam_address_bcs=>create_internet_address( 'EMAIL ID')."EMAIL ID
* add recipient object to send request
GO_send_request->add_recipient( GO_recipient ).
* ---------- send document ---------------------------------------
GV_sent_to_all = GO_send_request->send( i_with_error_screen = 'X' ).
commit work.
if GV_sent_to_all is initial.
message i500(sbcoms) with LV_EMAIL.
* message i500(sbcoms) with 'Email ID'."EMAIL ID
else.
message s022(so).
endif.
* ------------ exception handling ----------------------------------
* replace this rudimentary exception handling with your own one !!!
catch cx_bcs into Go_bcs_exception.
message i865(so) with go_bcs_exception->error_type.
endtry.
or
you can check the standard program
BCS_EXAMPLE_8Thanks
Surendra
2012 Feb 28 10:28 AM
Hi Surenra.
I tried "BCS_EXAMPLE_8" for sending mail when PO is created, with PO form as
attachment.
I wrote these code from "BCS_EXAMPLE_8" and created a method in busines object
ZBUS2012 and when i execute from the BO, the mail is getting triggered PO form as attachment.
But when i create a task in workflow and assign the same business objct and method, it is giving me "Exception Occured".
Kidnly tell me how to ressolve it.
Rahul
2012 Feb 28 10:45 AM
Kindly note that when i assigne spool request hardcode "RSPO_GET_ATTRIBUTES_SPOOLJO" then the mail is triggering with attachemnt, but when i try to fetech the spool number from table TSP01 and trasfer the variable RQIDENT to the FM, it is giving the error " Exception Occured.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |