Code: Alles auswählen.
data(html_content) = get_order_error_text( ... ).
data(distributionlist_name) = conv SO_OBJ_NAM( GET_PARAMETER( NAME = 'ERROR_MAILLIST' )
).
TRY.
data(send_request) = cl_bcs=>create_persistent( ).
send_request->set_document( cl_document_bcs=>create_document(
i_type = 'HTM'
i_text = html_content
i_length = conv SO_OBJ_LEN( lines( html_content ) * 255 * 2 ) "length of line of SOLI: 255, factor 2 for safety
i_subject = conv #( title )
)
).
send_request->SET_MESSAGE_SUBJECT( title ).
* catch CX_SEND_REQ_BCS. "
data(recipient) = CL_DISTRIBUTIONLIST_BCS=>GETU_PERSISTENT(
I_DLINAME = distributionlist_name
I_PRIVATE = ''
).
send_request->add_recipient( i_recipient = recipient
i_express = 'X' ).
data(sent_to_all) = send_request->send( i_with_error_screen = 'X' ).
if sent_to_all <> 'X'.
append value #( type = 'E'
number = '010'
ID = 'XXX'
message = |Bestellnummer: { purchase_number } - Warenkorb-ID: { basket_id }|
MESSAGE_V1 = purchase_number
MESSAGE_V2 = basket_id )
to I_bapi_data-return.
endif.
COMMIT WORK.
catch cx_bcs into data(bcs_exception).
data(errortext) = bcs_exception->GET_LONGTEXT(
PRESERVE_NEWLINES = 'X'
).
Errorcode:'
&& bcs_exception->get_text( )
&& '. Langtext:'
message_v1 = 'Fehler beim Senden der Errormail aufgetreten.'
message_v2 = 'Errorcode:'
message_v3 = bcs_exception->get_text( ) ) to I_bapi_data-return.
data offset type i.
data partial_errortext type string.
endtry.
Code: Alles auswählen.
data(sent_to_all) = send_request->send( i_with_error_screen = 'X' ).
Folgende Benutzer bedankten sich beim Autor a-dead-trousers für den Beitrag:
Xilukarim