‎2012 Jan 25 7:26 AM
Hi All,
I have a requirement to consider the data given input, create a pdf file add it as attachment and send it as an email. I am using the cl_document_bcs->add_attachment but getting the X_ERROR , on debugging it i find that at certain point there is no RFC destination in Profile is the error due to this ?
Other thing is that the program is wroking fine to send a normal email without any attachment, but creating an attachment adn sending is failing.
CALL METHOD v_document->add_attachment
EXPORTING
i_attachment_type = 'pdf' "c_attch_type
i_attachment_subject = 'attach'
I_ATTACHMENT_SIZE = l_size
I_ATT_CONTENT_HEX = it_line_bin_solix
i_att_content_text = it_line.
CATCH cx_document_bcs into ex_root.
MOVE ex_root->get_text( ) TO trace_message.
ENDTRY.<added code tags>
Kindly give suggestions on this.
Regards,
Mithun
Edited by: Suhas Saha on Jan 25, 2012 1:07 PM
‎2012 Jan 25 7:39 AM
Are You sure that you have give 'PDF' in caps in your program? and check whether you are getting all the datas before calling the method.
in my program, i have used like this and it is working fine for me,
I am getting PDF content from the form...
DATA ls_formoutput TYPE fpformoutput.
DATA pdf_content TYPE solix_tab.
DATA lp_pdf_size TYPE so_obj_len.
DATA lv_mail_title TYPE so_obj_des.
*Attach the PDF .
lp_pdf_size = XSTRLEN( ls_formoutput-pdf ).
pdf_content = cl_document_bcs=>xstring_to_solix(
ip_xstring = ls_formoutput-pdf ).
document->add_attachment(
i_attachment_type = 'PDF'
i_att_content_hex = pdf_content
i_attachment_size = lp_pdf_size
i_attachment_subject = lv_mail_title ) .
‎2012 Jan 25 8:46 AM
Hi Playsuji,
Have used Caps now but still no difference.
my code :
CALL METHOD v_document->add_attachment
EXPORTING
i_attachment_type = 'PDF' "c_attch_type
i_attachment_subject = 'attach'
I_ATTACHMENT_SIZE = l_size
I_ATT_CONTENT_HEX = it_line_bin_solix.
i_att_content_text = it_line.
CATCH cx_document_bcs into ex_root.
MOVE ex_root->get_text( ) TO trace_message.
ENDTRY.
Are there any configurations to be maintained for attachments , i doubt it as i am getting the normal mail without attachments.
Regards,
Mithun
‎2012 Jan 25 7:41 AM
MOVE ex_root->get_text( ) TO trace_message.Can you share the details of trace_message ?
Also, why are you passing both the text & binary data together(params I_ATT_CONTENT_HEX & i_att_content_text )? Try passing either one of these & check.
BR,
Suhas
‎2012 Jan 25 8:43 AM
Hi Suhas ,
I have now tried only with one but still the same error trace message just says "An exception has occured". But when i debug it shows X_ERROR and while i try to debug further i find that it goes to SO_ATTACHMENT_INSERT_API1 then to SO_ATTACHMENT_INSERT , in this we have CALL FUNCTION 'SO_ATTACHMENT_INSERT' DESTINATION PROFILE-RFCDES where RFCDES is shown as none for my case and it is not going in this FM , later on it asks for SO_EXT_DB_EXIT exit funciton which is not present in my system and give sout this error.
Regards,
Mithun
‎2012 Jan 25 10:28 AM
In my system SO_EXT_DB_EXIT FM does not exist & is not called.
I'm sure X_ERROR is not raised here, debug properly & get back with your observations.
BR,
Suhas
Edited by: Suhas Saha on Jan 25, 2012 4:01 PM