on 08-01-2023 1:36 PM
Dear experts,
Could anybody check in SAP ECC system, how to use SO_NEW_DOCUMENT_ATT_SEND_API1 from SAP RPA or BPA tools with binary data (PDF file)? I tried CONTENTS_BIN and CONTENTS_HEX structures without success so far. In case of BIN the RFC function performs implicit conversion to Unicode, in case of HEX I am unable to pass the parameters due to its "wrong type".
I would appreciate your help asap as I needed to hand over my part to colleagues yesterday. ;-(
Thank you very much and kindest regards,
JV
More complex for you, because you are familiar with the function modules, or things like that. You can learn new things, and in the future, you will find it easier.
All the examples of CL_BCS are provided by SAP already = programs BCS_EXAMPLE_*.
But you're right concerning RFC. That would require a simple custom RFC-enabled function module, which uses BCS.
Example with BCS:
DATA(email) = cl_document_bcs=>create_document(
i_type = 'RAW'
i_subject = 'ABAPlist'
i_text = VALUE #( ( line = 'Hi,' ) ( line = 'attached you will find the list.' ) ) ).
email->add_attachment(
i_attachment_type = 'TXT'
i_attachment_subject = 'filename.txt'
i_att_content_text = cl_bcs_convert=>string_to_soli( concat_lines_of( sep = |\r\n| table = VALUE string_table(
( `This is the first line` )
( `This is the second line` ) ) ) ) ).
data(xlsx_data) = value xstring( ).
email->add_attachment(
i_attachment_type = 'XLS'
i_attachment_subject = 'attachment.xlsx'
i_attachment_size = |{ xstrlen( xlsx_data ) }|
i_att_content_hex = cl_bcs_convert=>xstring_to_solix( xlsx_data )
i_attachment_header = VALUE #( ( line = |&SO_FILENAME=List_of_roles.xlsx| ) ) ).
DATA(bcs) = cl_bcs=>create_persistent( ).
bcs->set_document( email ).
bcs->add_recipient( i_recipient = cl_cam_address_bcs=>create_internet_address( 'john.doe@sap.com' ) ).
bcs->set_send_immediately( abap_true ). " prefer avoiding that, batch it instead
bcs->send( ).
COMMIT WORK.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.