02-07-2011 7:43 PM
WE did a unicode upgrade about 2 weeks ago and since then, when using function module SO_DOCUMENT_SEND_API1 to attach a .txt file to an email, the TEXT file looks to be spaced incorrectly. what I mean it there is a LOW-VALUE/Space between every character in the file, so when Notepad opens it, the CR_LFis there but there is a space between each so it just becomes one continuous string of data. is this a code page thing or a SCOT setting?
I could not past a screen shot in here but in a Hex Editor it shows TWO ZEROS '00' between every character, which are low-values.
02-08-2011 1:06 PM
SO_DOCUMENT_SEND_API1 doesn't handle attachments, does it? thought that was the ATT version of this antiquated API....should be inserting that file/adata into the email body with this API.
02-08-2011 3:30 PM
We have been using this general code below for sometime now. Unicode upgrade of the databases has caused the attachments to have spaces between each character in the attachment. We get the attachment but the data inside is over spaced. if you go thru the attached .txt file, you can delete all the extra spaces, including those between the CR/LF and
Notepad looks to be able to understand where each line ends now.
it_reclist = email addresses
it_objtxt = body of the email message
it_objbin = attachment table of type solisti1
it_packing_list = table of sopcklsti1
*Calling the FM SO_DOCUMENT_SEND_API1 to send the email and passing all
*the values and then commiting the work
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = wa_doc_data
put_in_outbox = c_x
commit_work = c_x
TABLES
packing_list = it_packing_list
contents_bin = it_objbin
contents_txt = it_objtxt
receivers = it_reclist
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.
CASE sy-subrc.
WHEN 0.
wa_errlog-msg = 'Email send successfully'(021).
APPEND wa_errlog TO it_errlog.
WHEN OTHERS.
wa_errlog-msg = 'Email sending failed'(022).
APPEND wa_errlog TO it_errlog.
ENDCASE.
02-09-2011 4:23 PM
Hi,
can you please check SAP note 190669 ?
Excerpt:
As of Release 6.10, we recommend that you no longer use the API1
interface for sending documents. Instead, use the BCS interface.
You will also find sample code in that note.
Best regards,
Nils Buerckel
SAP AG