Hi,
I am trying to add an invoice output of sapscript as an attachment. Email with attachment is getting generated but the problem is all the russian text is showing as XXXXXXX while the english ones in the same attachment are being displayed as it is. Can some one tell me where it is going wrong? You can see the attached PDF.
So far what I have done is..
lvs_itcpo-tdgetotf = 'X'.
where lvs_itcpo is the structure I am passing to OPTIONS parameter of OPEN_FORM.
then in close form section I am getting otf table as given below
CALLFUNCTION'CLOSE_FORM'
IMPORTING
result = i_itcpp
TABLES
otfdata = it_otf
EXCEPTIONS
OTHERS = 1.
Then converting otf to xstring.
CALLFUNCTION'CONVERT_OTF'
EXPORTING
format = 'PDF'
max_linewidth = '132'
use_cascading = 'X'
IMPORTING
bin_filesize = w_bin_filesize
bin_file = c_binfile
TABLES
otf = it_otf
lines = it_pdf_temp.
Now for sending mail
w_body_msg = ' '.
APPEND w_body_msg TO i_body_msg.
CLEAR w_body_msg.
DATA: g_tab_lines TYPEi.
"Write Packing List for Body
DESCRIBETABLE i_body_msg LINES g_tab_lines.
w_packing_list-head_start = 1.
w_packing_list-head_num = 0.
w_packing_list-body_start = 1.
w_packing_list-body_num = g_tab_lines.
w_packing_list-doc_type = 'RAW'.
APPEND w_packing_list TO i_packing_list.
CLEAR w_packing_list.
DATA: v_lines_bin TYPEi.
"Write Packing List for Attachment
w_packing_list-transf_bin = 'X'.
w_packing_list-head_start = 1.
w_packing_list-head_num = 0."1.
w_packing_list-body_start = 1.
* DESCRIBE TABLE i_objbin LINES v_lines_bin.
DESCRIBETABLE it_solix LINES v_lines_bin.
* READ TABLE i_objbin INDEX v_lines_bin.
READTABLE it_solix INDEX v_lines_bin.
w_packing_list-doc_type = 'PDF'.
w_packing_list-obj_descr = 'PDF Attachment'.
w_packing_list-obj_name = 'PDF_ATTACHMENT'.
w_packing_list-doc_size = v_lines_bin * 255.
w_packing_list-body_num = v_lines_bin.
APPEND w_packing_list TO i_packing_list.
CLEAR w_packing_list.
"Fill the document data and get size of attachment
READTABLE it_pdf_temp INTO w_pdf INDEX g_tab_lines.
w_document_data-doc_size = ( g_tab_lines - 1 ) * 255 + STRLEN( w_pdf ).
"Receivers List.
w_receivers-rec_type = 'U'."Internet address
w_receivers-receiver = d_email.
w_receivers-com_type = 'INT'.
* w_receivers-notif_del = 'X'.
* w_receivers-notif_ndel = 'X'.
APPEND w_receivers TO i_receivers .
CLEAR:w_receivers.
"Function module to send mail to Recipients
DATA: g_sent_to_all TYPE sonv-flag.
CALLFUNCTION'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = w_document_data
put_in_outbox = 'X'
commit_work = 'X'
IMPORTING
sent_to_all = g_sent_to_all
TABLES
packing_list = i_packing_list
* contents_bin = i_objbin
contents_hex = it_solix
contents_txt = i_body_msg
receivers = i_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.