on 2024 Dec 12 9:45 AM
Hey all,
We have currently created a flexible workflow in SAP Cloud where the approver receives a notification from SAP that a PO is ready for approval. (Essentially, the deadline is set to 0 minutes so that the email is sent out immediately.) This email is sent with the sender address configured in CBC under 'Define Default Email Sender Address for Email Outbound,' which is essentially the default email address of our system.
Now the question: Is it possible to change the sender email address specifically just for this workflow, i.e., for the PO approval notifications only?
Thank you in advance
Request clarification before answering.
i use TC SWNCONFIG to send specific WF to a specific user u can do a lot of configoration AND change the sender.
if its aint working u need to make FB where u write a code to send email to a specific user and chosing the sender.
check this excample i did before:
DATA: lt_mail TYPE ptreq_email_receivers_tab.
DATA: ls_mail TYPE somlreci1.
DATA lv_recipient TYPE adr6-smtp_addr.
DATA: mailtext TYPE string.
DATA: ls_subject TYPE so_obj_des.
DATA: ls_body TYPE soli.
DATA: ls_starts TYPE soli.
DATA: datum TYPE char10.
DATA: lt_text TYPE soli_tab.
DATA: ls_text TYPE soli.
DATA: lo_sender TYPE REF TO if_sender_bcs VALUE IS INITIAL,
lo_document TYPE REF TO cl_document_bcs VALUE IS INITIAL,
lo_recipient TYPE REF TO if_recipient_bcs VALUE IS INITIAL,
lo_send_request TYPE REF TO cl_bcs VALUE IS INITIAL.
SELECT * FROM vbpa INTO TABLE @DATA(lt_vbpa)
WHERE vbeln = @iv_vbeln.
SORT lt_vbpa BY kunnr.
LOOP AT lt_vbpa INTO DATA(ls_vbpa) WHERE
parvw = 'Y0'.
IF ls_vbpa-pernr <> '00000000'.
SELECT SINGLE FROM pa0105
FIELDS usrid_long
WHERE pernr EQ @LS_vbpa-pernr
AND begda LE @SY-datum
AND endda GE @SY-datum
AND subty EQ '0010' INTO @LS_mail.
CLEAR ls_vbpa.
ENDIF.
ENDLOOP.
LOOP AT lt_vbpa INTO ls_vbpa WHERE
parvw = 'ZZ'.
ENDLOOP.
SELECT SINGLE FROM kna1 AS a
INNER JOIN t005t AS b ON a~land1 = b~land1
FIELDS b~land1, a~name1
WHERE a~kunnr = @LS_vbpa-kunnr AND
b~spras = @SY-langu INTO @DATA(ls_kna1).
ev_mail_its_pm = ls_mail.
APPEND ls_mail TO lt_mail.
WRITE iv_planstart TO datum DD/MM/YYYY.
CONCATENATE 'Sie erhalten diese Email, weil Sie als Projektleiter*in für Digitalisierung zum Projekt<b>' ls_vbpa-vbeln ls_kna1-name1 INTO ls_body SEPARATED BY space.
CONCATENATE ' </b>in SAP hinterlegt sind. <b>Am ' datum '</b> findet der <b>Inbetriebnahme-Start</b> für genanntes Projekt statt. Bitte planen Sie zeitnah das <b>Digitalisierungs Kick-off Meeting</b> und alle ' INTO ls_starts SEPARATED BY space.
ls_text = 'Sehr geehrte Kolleg*in,</br></br>'.
APPEND ls_text TO lt_text.
CLEAR: ls_text.
APPEND ls_text TO lt_text.
CLEAR: ls_text.
ls_text = ls_body.
APPEND ls_text TO lt_text.
CLEAR:ls_text.
ls_text = ls_starts.
APPEND ls_text TO lt_text.
CLEAR:ls_text.
ls_text = 'weiteren Schritte zur Inbetriebnahme. <br> <br> Viel Erfolg im weiteren Projektverlauf! <br> Freundliche Grüße <br> Ihr Digitalisierungs-Team'.
APPEND ls_text TO lt_text.
* create send request to handle mail sending
TRY.
lo_send_request = cl_bcs=>create_persistent( ).
CATCH cx_send_req_bcs.
ENDTRY.
CONCATENATE 'Inbetriebnahme-Start' ls_vbpa-vbeln ls_kna1-land1 INTO ls_subject SEPARATED BY space.
TRY.
lo_document = cl_document_bcs=>create_document(
i_type = 'HTM'
i_text = lt_text
i_subject = ls_subject
).
CATCH cx_document_bcs .
ENDTRY.
* pass the document to send request
TRY.
lo_send_request->set_document( lo_document ).
CATCH cx_send_req_bcs .
ENDTRY.
** create sender object
* TRY.
* lo_sender = cl_cam_address_bcs=>create_internet_address( 'Rechnungen@krones.com' ).
* CATCH cx_address_bcs.
* ENDTRY.
** set sender
* TRY.
* lo_send_request->set_sender(
* EXPORTING
* i_sender = lo_sender ).
* CATCH cx_send_req_bcs.
* ENDTRY.
lv_recipient = 'keine.ahnung@gmail.com'.
LOOP AT lt_mail INTO lv_recipient.
* create recipient object
TRY.
lo_recipient = cl_cam_address_bcs=>create_internet_address(
lv_recipient ).
CATCH cx_address_bcs.
ENDTRY.
TRY.
lo_send_request->add_recipient( i_recipient = lo_recipient ).
CATCH cx_send_req_bcs.
ENDTRY.
ENDLOOP.
* set recipient
TRY.
lo_send_request->add_recipient(
EXPORTING
i_recipient = lo_recipient
i_express = abap_false ).
CATCH cx_send_req_bcs.
ENDTRY.
* send email
DATA: rv_mail_sent TYPE boolean.
TRY.
lo_send_request->send(
EXPORTING
i_with_error_screen = abap_true
RECEIVING
result = rv_mail_sent ).
CATCH cx_send_req_bcs.
ENDTRY.
* commit work to create mail transmition
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 |
---|---|
5 | |
5 | |
4 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.