2022 Aug 17 1:47 PM
Hi, I was having an issue when sending a document which is an excel file when I'm using the function module SO_NEW_DOCUMENT_ATT_SEND_API1. The chinese and japanese characters turns into special unreadable characters. Is there a way to send use CL_BCS instead of using this FUNCTION MODULE?
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = lx_mail_title
commit_work = abap_true
IMPORTING
sent_to_all = l_sent_to_all
TABLES
packing_list = lt_objpack
object_header = lt_objhead
contents_bin =
contents_txt =
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
.
IF SY-SUBRC <> 0.
ENDIF.
2022 Aug 17 1:59 PM
Your issue about characters is not related to using SO_NEW_DOCUMENT_ATT_SEND_API1 or CL_BCS.
Your issue is about how you encode the characters (I guess your "Excel" file is format CSV or tab-delimited values). The best character set supported by Microsoft Excel is UTF16-LE, you should add a BOM so that to help Excel recognize it.
2022 Aug 17 2:12 PM
sandra.rossi Actually I'm also using the SO_NEW_DOCUMENT_ATT_SEND_API1 so I will receive a SEND REQUEST in SOSA and a document in SBWP. However, when I use the FM, the document which is an excel fill gets sent to SBWP and I will receive a send request in SOSA. The excel file attachement in SBWP will have a special characters.
However, when I don't use the FM, the document will be sent to the SBWP bbecause I have a code but I will not receive a send request in SOSA or others call SOST(I can't access this)
"Set the recipientlo_send_request->add_recipient( lo_sender ).
2022 Aug 17 2:29 PM
Hi Wane,
Yes you can, although that is probably not going to solve your encoding issue as Sandra Rossi said above. That is probably an encoding issue that you have on your file. In any case, to answer your question, if you make a quick search in SAP you will find many examples. This is one I just found:
document = cl_document_bcs=>create_document(
i_type = 'RAW'
i_text = body
i_subject = subject).
* add the spread sheet as attachment to document object
document->add_attachment(
i_attachment_type = 'xls'
i_attachment_subject = filename
i_attachment_size = size
i_att_content_hex = binary_content ).
* add document object to send request
send_request->set_document( document ).
Now you only have to send it and you will receive an email with the attached file.
2022 Aug 17 3:27 PM
The fact that you see the outbound message in SOSA, SOST, SBWP or whatever, doesn't depend on using the FM or the class, but on the sender parameter you pass. In my system, if I use CL_BCS, I can see the message in SOSA/SOST (both run exactly the same program/same data is displayed). CL_BCS is just the latest API that is recommended officially by SAP.
My comment was more about to point out that you are trying another solution without understanding the actual issue. With CL_BCS, that will be the same issue. I hope you understand. If not, I'd be happy to clarify.
2022 Aug 18 6:24 AM
sandra.rossi Thanks! I was able to figure out how to receive a SEND request in SOSA/SOST. However I was having issues in which the recipient is SAP User ID instead of the email equivalent of the SAP User ID. Also, I'm receiving the send request by BY REMOTE SAP instead of BY EMAIL.
Expected send method: By Email instead of by remote sap
Expected Recipient: john_carter12@yahoo.com but it shows the sap user of john carter which is johncar12
2022 Aug 18 9:02 AM
You can send to JOHNCAR12, and the user will see the message in the inbox (SOIN/SBWP).
As SAP user JOHNCAR12 is assigned to an email address, the user will also receive an email.
Maybe there's a little configuration needed in SCOT (the general SAPconnect transaction).
SAP Remote Mail is just sending the message through RFC.
You are exploring many things, but don't you just want to send an email (through internet)?
2022 Aug 18 10:09 AM
sandra.rossi The user wants this setup so I have no say. The only issue is they want in the recipient column It has to show the internet email address instead of its SAP USER ID.
2022 Aug 18 10:39 AM
Okay. So, it's 2 different requirements:
I guess you know how to do number 1. You should ask a question for number 2. The requirement should be precisely described: What do they want to see if there are several recipients? What if one SAP user doesn't have an email address? etc. And most importantly: is there any interest to pay for that?