Hi Experts,
I have to send a mail to outlook the data of an Internal table.
I am using the FM SO_DOCUMENT_SEND_API1
My Internal table width is around 400 characters, But the CONTENTS_BIN will allow only 255 characters.
So I am trying to use CONTENTS_HEX. To my knowledge we have to pass binary content to CONTENTS_HEX table.
I have used SCMS_STRING_TO_XSTRING to convert my string to XString and then used SCMS_XSTRING_TO_BINARY to convert XString to Binary.
See the below code for reference.
CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
EXPORTING
text = lf_string
* MIMETYPE = ' '
* ENCODING =
IMPORTING
buffer = lf_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.
CLEAR: lf_output_length.
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = lf_xstring
append_to_table = 'LT_CONTENTS_HEX'
IMPORTING
output_length = lf_output_length
TABLES
binary_tab = lt_contents_hex[].
I have filled the PACKING_LIST table as below.
ls_packing_list-transf_bin = 'X'.
ls_packing_list-head_start = 1.
ls_packing_list-head_num = 1.
ls_packing_list-body_start = 1.
ls_packing_list-doc_type = 'PDF'.
ls_packing_list-obj_descr = 'Object Description Packing List1'.
ls_packing_list-obj_name = 'Object Name Packing List1'.
DESCRIBE TABLE lt_contents_hex LINES ls_packing_list-body_num.
ls_packing_list-doc_size = ls_packing_list-body_num * 255.
I am able to get the mail with PDF attachment, But the PDF is not opening.
Can any one let me know how to resolve this Issue?
Is the Packing list is Incorrect(If so how to fill the PACKING_LIST for CONTENT_HEX table
or the Binary data it self is incorrect(If so How to convert the string into Binary.
Or else Is there any other way to send internal table which has 400 characters width as a PDF attachment to an out look mail?
Thanks in Advance.
Have a nice day.
Regards
Avinash