Symptom
This KBA explains how to return multiple email addresses (including "TO", "CC", and "BCC" options) in the "Email Recipients" channel of the "Output Parameter Determination" app for sales documents.
"Image/data in this KBA is from SAP internal systems, sample data, or demo systems. Any resemblance to real data is purely coincidental."
Environment
SAP S/4HANA Cloud Public Edition
Resolution
Since SAP S/4HANA Cloud CE2308, it becomes possible to have multiple email addresses using custom logics. There is a new BAdI "Addition of Email Recipients" which will be called as part of the output parameter determination runtime.
Bellow steps explain how to configure in the "Output Parameter Determination" app, how to enable the BADI. Besides, sample codes are included:
- Select "Email Recipient" as the determination step in the "Output Parameter Determination" app.
- Add new lines.
- Under the "Email Address" column, select the "Select Expression" option:
- Under the "Search Criteria", provide below values.
Click the "Search" button and select "Add email recipients from custom logic":
Application Name = OPD_APOC_SYSTEM
Expression Type = Constant - Activate changes in the "Output Parameter Determination" app by clicking the "Activate" button and BAdI "Addition of Email Recipients" will be called with these configurations:
Bellow steps explain the implementation of the BAdI:
- Open the "Custom Logic" app and click the "Create" button:
- Select "Output Request Item" as the business context and go to the "Extension Point" part and click the "Step 2" button:
- Maintain values for the filter and click "Save":
- Provide "Implementation Description" and "Implementation ID". Then click the "Review" and "Create" button:
- Click the "Publish" button:
- Write custom logics to get output to PO creator and click on the "Save and Publish" button:
* This method can be used to add email recipients to the current output item for Sales Order during output parameter determination and is called depending on the maintained filter value for the
* Below are the example logics:
DATA: ls_additional_email_recipient LIKE LINE OF additionalemailrecipients.
" Get Person Number
SELECT PersonNumber
FROM I_ContactPerson WITH PRIVILEGED ACCESS
WHERE Customer = @recipient
INTO TABLE @DATA(lt_PersonNumber).
IF lt_PersonNumber IS NOT INITIAL.
" Get Email Address
SELECT EmailAddress
FROM I_AddrCurDefaultEmailAddress WITH PRIVILEGED ACCESS
FOR ALL ENTRIES IN @lt_PersonNumber
WHERE AddressPersonID = @lt_PersonNumber-PersonNumber
INTO TABLE @DATA(lt_emailaddress) .
LOOP AT lt_EmailAddress ASSIGNING FIELD-SYMBOL(<fs_EmailAddress>).
ls_additional_email_recipient-outputrequestitememailrole = 'CC'.
ls_additional_email_recipient-outputrequestitememailaddress = <fs_EmailAddress>-EmailAddress.
APPEND ls_additional_email_recipient TO additionalemailrecipients.
ENDLOOP.
ENDIF.
See Also
KBA 3331087 - SAP S/4HANA output control - BAdI: Addition of Email Recipients
Keywords
SAP S/4HANA Cloud Public Edition, Multiple, Email addresses, TO, CC, BCC, Email settings, Email Recipients, Output parameter determination, Sales document, BAdI, Addition of Email Recipients , KBA , SD-SLS-GF-OC-2CL , S/4HANA: Output Control on Sales Documents (Public Cloud) , How To
SAP Knowledge Base Article - Public