Hi All,
As my Post has been rejected from SAP Community Network Forum, Sorry for posting my thread in two categoires.
I have tried to search for solution in SDN but could not found a relevent solution.
I am able to send an Internal table using cl_document_bcs class to send XLS and Doc types as attachment as follows:
For Example :
My Internal table is tbl_bseg which final output table:
data : lv_string TYPE string.
*- tbl_bseg contains my data so.. LOOP AT tbl_bseg INTO wa_bseg. CONCATENATE lv_string wa_bseg-bukrs wa_bseg-belnr wa_bseg-gjahr wa_bseg-buzei wa_bseg-zumsk CN_CR_LF INTO lv_string SEPARATED BY CN_TAB.
*- Horizontal Tab Stop Character
*- Carriage Return and Line Feed CLEAR wa_bseg. ENDLOOP. DATA: lv_xstring TYPE xstring, ta_excelx TYPE SOLIX_TAB.
*- Convert the string into xstring
call function 'SCMS_STRING_TO_XSTRING' exporting TEXT = p_string IMPORTING BUFFER = lv_xstring EXCEPTIONS FAILED = 1 OTHERS = 2. IF SY-SUBRC 0. MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. ENDIF.
*- Convert the string into binary table
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY' EXPORTING buffer = lv_xstring TABLES binary_tab = ta_excelx.
*-
wa_attachments-type = 'XLS'
wa_attachments-subject = 'This final testing - XLS'.
wa_attachments-content_hex = lv_xstring.
APPEND wa_attachments to ta_attachments.
*-------- create and set document with attachment ---------------
cl_documents = cl_document_bcs=>create_document( i_type = CN_RAW i_text = gta_body i_subject = wa_subject ).
* add attachment to document CALL METHOD cl_document_bcs->add_attachment EXPORTING i_attachment_type = wa_attachments-TYPE i_attachment_subject = wa_attachments-SUBJECT i_att_content_hex = wa_attachments-CONTENT_HEX.
But my issue is to send a the same Internal Table tbl_bseg as attachement as PDF using in the same steps:
A sample snippet of code could be helpful or any valuable solution are welcome.
Regards,
Suneel G