‎2009 Oct 14 3:37 PM
Hi,
I use method add_attachment of class cl_document_bcs to add an attachement. The problem is:
when I use the method with
CALL METHOD document->add_attachment
EXPORTING
i_attachment_type = documents_line-type
i_attachment_subject = documents_line-subject
i_att_content_text = documents_line-content_text.
documents_line-content_text is an internal table with several lines, but when I look to the attachment after running it, I get no internal table, what I get is a long row.
Did someone has an idea how to get the same internal table which I habe in documents_line-content_text???
‎2009 Oct 15 9:55 AM
What do you mean by: "but when I look to the attachment after running it" ?
i_att_content_text is an internal table of a 255 char field. What are you getting, and where, and what do you expect to get?
matt
‎2009 Oct 14 7:20 PM
‎2009 Oct 15 9:55 AM
What do you mean by: "but when I look to the attachment after running it" ?
i_att_content_text is an internal table of a 255 char field. What are you getting, and where, and what do you expect to get?
matt
‎2009 Oct 15 10:34 AM
Hello Matt,
when I have following in my internal table:
Line 1
Line 2
I get in the attachment
Line 1 Line 2
I set the type of the attachment to csv but everything is in one line
‎2009 Oct 15 11:41 AM
You need to put in your own carriage return/line feeds. CL_ABAP_CHAR_UTILITIES=>CR_LF
‎2009 Oct 15 11:12 AM
<li>Please go through the below std demo programs
Thanks
Venkat.OBCS_EXAMPLE_5 BCS Use, Example 5 (Winword Attachment)
BCS_EXAMPLE_7 BCS: Send E-Mail with Self-Created Excel Attachment (Example)
‎2010 Jan 21 11:44 AM
‎2011 Feb 04 10:46 AM
Hi,
I also faced the same problem.
use i_attachment_type = 'RAW' in add_attachment method.
It'll work.
Thanks,
Surajit
‎2010 Jan 21 12:06 PM
HI,
Try this code it will definitely work
data: gv_document type ref to cl_document_bcs.
data: gv_mail_text type bcsy_text,
gv_mail_text_row type soli.
data: gv_attachment type solix_tab.
try.
gv_mail_text_row = text-001.
append gv_mail_text_row to gv_mail_text.
clear gv_mail_text_row.
describe table gv_mail_text lines gv_num_rows.
gv_num_rows = gv_num_rows * 255.
move gv_num_rows to gv_text_length.
try.
call method cl_document_bcs=>create_document
EXPORTING
i_type = 'RAW'
i_subject = l_subject2
i_length = gv_text_length
i_text = gv_mail_text
RECEIVING
result = gv_document.
catch cx_document_bcs .
endtry.
gv_attachment = cl_document_bcs=>xstring_to_solix( ip_xstring = l_pdf_xstring ).
Define File Name
attcdoctype = 'pdf'.
atttitle = vbco3-vbeln.
Create Document
gv_document->add_attachment( exporting i_attachment_type = attcdoctype
i_attachment_subject = atttitle
i_attachment_language = sy-langu
i_att_content_hex = gv_attachment ).
catch cx_bcs into bcs_exception.
ENDTRY.
Regards,
Manesh.R