Integrating Code Lists

Objective

After completing this lesson, you will be able to set up Code List integration by the example of Incoterms

Code List Replication

Code List Replication is a comfortable alternative to manual code list maintenance, which can reduce the maintenance effort tremendously, especially for larger code lists and where several languages need to be supported. The replication requires some additional steps for preparation, and then only a few small actions for the actual replication of a specific code list.

After some basic preparation steps that are necessary for all code list replication scenarios, every code list replication is carried out by the corresponding integration flow.

How Code List Replication Works

For some code lists, you will find two integration flows where one’s name starts with "Deprecated". The following screenshot shows such two integration flows for the Incoterms code list on the SAP Business Accelerator Hub.

New and old version of iFlow. Old with Deprecated

The old, deprecated code list integration flows worked similarly to other master or transactional integration flows, where SAP S/4HANA sends data to the integration flow. This was additional setup effort on the SAP S/4HANA side, because outbound communication settings needed to be defined per code list. In contrast to that, the new variants fetch the currently maintained code list values from SAP Sales and Service Cloud Version 2 and SAP S/4HANA via REST and OData services, respectively, compare the values, and make the required changes in SAP Sales and Service Cloud Version 2, so that the values match exactly the ones in SAP S/4HANA afterwards. They run on a timer-based schedule or can be triggered manually.

The following screenshot shows this procedure in the Design view of the Replicate Incoterms Classification from SAP S4HANA integration flow, with the most important steps highlighted:

Screenshot of the Incoterms integration flow with the most important steps highlighted
  1. Start-Timer to schedule or manually run the integration flow
  2. Fetch the currently maintained code values from the cloud CRM (required to remove existing ones)
  3. Fetch the currently maintained code values from SAP S/4HANA
  4. Compare code values and prepare the final code list for the cloud CRM
  5. Send the final code list to the cloud CRM (which may involve instructions to delete existing code values)

Integrating Code Lists

Initial Setup Steps for Code List Replication

The replication of code lists requires the following initial setup steps across the systems, which are independent of a particular code list. They are only required once:

  • SAP Sales and Service Cloud Version 2:
    • Additional technical user + role required for reading code lists via REST API.
    • User of the communication configuration cannot be reused for that
  • SAP S/4HANA:
    • OData service providing access to the code lists
    • Existing technical user needs access to it
  • Cloud Integration:
    • Script collection of the master data integration package must be deployed

After preparing all systems, you can configure and deploy code list replication integration flows.

Video: Integrating Code Lists

The following video demonstrates how to prepare all systems and how to run the replication of a particular code list with the example of Payment Terms, which are also referred to as Cash Discount Terms in some places.

The following sections summarize the video and list the shown tasks.

Configuration in SAP S/4HANA

All code list values are being provided to Cloud Integration via an OData service (step 3 in the graphic earlier). This service must be made accessible.

You can enable the OData service endpoint via the SAP Gateway Service Administration using transaction /IWFND/V4_ADMIN. (You may have to call the transaction as /N/IWFND/V4_ADMIN.)

  1. Navigate to Published Service Groups.
  2. Search for the Service Group ID: CDI_CDS with System Alias: LOCAL.
  3. Publish the service group.

Configuration in SAP Sales and Service Cloud Version 2

For the initial load of a code list, it’s mandatory to delete all codes in the cloud CRM that do not exist in SAP S/4HANA. The integration flow reads the currently maintained code list values via REST services. Those cannot be accessed by the technical user from the communication configuration. This requires a separate technical user and a technical role instead.

Create a technical role:

  1. Navigate to SettingsRoles and make sure to change the filter to Technical Roles.
  2. Enter a role name, for instance: S4_CODELIST_INTEGRATION
  3. Assign Business Services as needed by the integration flow/code list. The sample code list Cash Discount Terms / Payment Terms requires the Business Partner REST API (see the remark following hint for further details).

Create a technical user:

  1. Navigate to SettingsUsersand make sure to change the filter to Technical Users.
  2. Give the user a meaningful name.
  3. In the demonstration, the user was named T41CLNT400_API_CODELISTS. This is maintained in a user credential in Cloud Integration later in the demonstration.
  4. Maintain authentication details. For simplicity reasons, a password has been assigned in the demonstration. However, the recommended way is to use certificates, especially in productive environments. For certificate-based authentication, you would need to create a separate certificate in the SAP BTP cockpit, since the Cloud Integration’s client certificate cannot be uploaded here, because it is already assigned to the other technical user.
  5. Assign the previously created technical role.

Hint

To find out which business services your technical role needs, you can have a look into the integration flows in the Design area, select the HTTP adapter for the Get CNS Codes step, and choose the HTTP-Connection properties tab as shown in the following screenshot.

iFlow in Design Mode with CNS REST API endpoint highlighted

Configuration in Cloud Integration

Before you can configure the integration flow, you have to maintain the credentials for accessing the cloud CRM’s REST APIs. In the demonstration, a username and password have been configured for that; hence, a security material of type user credential must be created in Cloud Integration. The remaining authentication details have been prepared earlier in this course.

Create the security material:

  1. Navigate to MonitorIntegrations and APIsSecurity Material and choose CreateUser Credential.
  2. Give the credential a meaningful name and take a note of the name. You have to enter it in the integration flow configuration in a moment. The demo uses a combination of the target system and the technical username in that system: SSCV2_T41CLNT400_API_CODELISTS
  3. Enter the username and the password as maintained in the cloud CRM previously and deploy the artifact.

In the Security Material list of the demo environment, you can also see the other user credential created earlier in the course, which is used to access SAP S/4HANA and is also used during this task.

The final step is configuring the code list integration flow. In the demonstration, the integration flow Replicate Cash Discount Terms from SAP S4HANA is used.

  1. Navigate to DesignIntegrations and APIspackage: SAP Sales Cloud and SAP Service Cloud Version 2 Integration for Master Data with SAP S/4HANA, and then Artifacts tab
  2. Select the integration flow Replicate Cash Discount Terms from SAP S/4HANA

Caution

If you haven’t deployed the Master Data Replication Script Collection yet, select it in the integration package’s artifacts list and choose Deploy. It’s a prerequisite for the code list replication integration flows They cannot run without the script collection.

Selecting the integration flow opens it so that you can compare it with the screenshot shown earlier in this lesson.

Configure the integration flow:

  1. The Timer tab can be used to schedule the integration flow. The default is On Deployment, which is good for initial runs after configuration changes.
  2. The Receiver tab gathers all details about the systems from which data is read and written to. This integration flow interacts with two systems using three different endpoints. They can be configured by switching the Receiver and Adapter Type dropdowns:
    1. Receiver S4HTTP Adapter: Since this adapter points to the SAP S/4HANA system, it must use the cloud connector, which can be achieved by selecting Proxy Type: On-Premise. Following that, the PROT-HOST-PORT must reflect the system entry of the Cloud Connector. In the demo environment, s4hana with port 8443 was used. The protocol in this field must always be http://. The connection is still encrypted through the secure tunnel of the Cloud Connector. Finally, enter the authentication details. In the demo, the already existing user credential SSCv2_to_S4 was used for basic authentication against SAP S/4HANA.
    2. Receiver CNSFirst HTTP Adapter: The cloud CRM has two endpoints – one for reading code lists and one for updating them – so there are two HTTP adapters shown. Based on the address, you can see which one you’re currently configuring. The business-partner-service endpoint belongs to the REST API for reading code list values. Enter the cloud CRM’s hostname and the credentials accordingly. Since the demonstrations use basic authentication for the REST API access, the name of the previously created user credential is entered here: SSCV2_T41CLNT400_API_CODELISTS
    3. Receiver CNSSecond HTTP Adapter: The second HTTP adapter updates the code lists. It uses the inbound-data-connector-service endpoint, which requires different authentication details. When switching to this HTTP adapter, the hostname should be pre-filled from the other CNS HTTP adapter that you maintained just before. So, you only need to fill in the authentication details for this endpoint. In the demonstrations, the Cloud Integration’s client certificate is used. Since this is the default one, you could leave the Private Key Alias field empty. However, entering the alias name sap_cloudintegrationcertificate makes it clear that the integration flow uses client certificate by intention.
  3. The More tab contains additional system-specific and data load-related settings:
    1. Client: The client of the SAP S/4HANA system. In the demo environment: 400.
    2. Sender Business System: The business system ID of SAP S/4HANA. In the demo environment T41CLNT400.
    3. Receiver Business System: The system ID of SAP Sales and Service Cloud Version 2. In the demo environment: sap_cloud_crm_my1001493.
    4. Language: The languages in which the descriptions of the code list values should be available in the cloud CRM. Use comma-separated, two-character ISO codes here. Please note that this only selects the corresponding language entries in SAP S/4HANA. This is not a real-time translation.
    5. Initial Load: If this field contains true, irrelevant codes in SAP Sales and Service Cloud Version 2 will be deleted.

Save the configuration.

Run Code List Replication

After configuring, you can deploy the code list replication integration flow. This will run the replication, assuming you set the timer to start immediately. In case you encounter any issues with the replication, you can refer to the Monitoring and Error Resolving unit later in this course.

If everything goes well, the Cash Discount/Payment Terms in SAP Sales and Service Cloud Version 2 will show the same values as in SAP S/4HANA.

Comparison of Payment Terms after replication.

If you would like to compare the Cash Discount/Payment Terms code list in your environment, you can do it as follows:

  • SAP Sales and Service Cloud Version 2: From the user menu, navigate to SettingsCustomersPayment Terms
  • SAP S/4HANA
    • Maintain: Use transaction MAINTAIN.
    • View Only: Use transaction SE16 or SE16N and open table TVZBT

Strategy for Code List Maintenance

After discussing manual maintenance and the replication of code lists in depth, let's summarize both approaches with a short When to use what? listing:

  • Replication
    • Synchronization, including translations and deletion of obsolete codes, tremendously saves effort for large code lists.
    • Can be run periodically to ensure code lists are up to date.
    • Due to the initial setup effort, it is particularly worthwhile when multiple code lists are in use.
  • Manual Maintenance
    • For code lists that do not support replication.
    • Might be less effort for small code lists without frequent changes and no or only a few translations
  • Conclusion: Replication of code lists is the preferred way for real projects where several code lists need to be synchronized.