SAP Knowledge Base Article - Public

3396631 - How to Use Multiple Email Addresses for Sales Documents in SAP S/4HANA Cloud Public Edition

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:

  1. Select "Email Recipient" as the determination step in the "Output Parameter Determination" app.
  2. Add new lines.
  3. Under the "Email Address" column, select the "Select Expression" option:
  4. 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


  5. 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:

  1. Open the "Custom Logic" app and click the "Create" button:
  2. Select "Output Request Item" as the business context and go to the "Extension Point" part and click the "Step 2" button:
  3. Maintain values for the filter and click "Save":

  4. Provide "Implementation Description" and "Implementation ID". Then click the "Review" and "Create" button:

  5. Click the "Publish" button:
  6. 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

Product

SAP S/4HANA Cloud Public Edition all versions