SAP MARKETING CLOUD: CDS VIEWS Part 1: Introduction to Custom CDS Views and their Role in Creating APIs
Written by: Tomáš Potzy, CRM Consultant
SAP Marketing Cloud is a tool covering all areas of marketing, so when working with it is much easier to acquire new but especially to retain existing customers. Of course, provided you know how to make the most of its potential. But what if you can’t do it or you need advice? These are the situations when Anodius blogs will help you, teaching you to work with it in a way you have never worked with before. In particular, in this series of blogs, we will focus on CDS Views, what they are, how to work with them, and where we can use them.
CDS Views in Brief
CDS Views are the basic unit of SAP HANA VDM (virtual data model). They allow us to access our data stored in a database, in different contexts. In cases where we need to create completely new ones, we must use development tools such as SAP Web IDE. However, due to the fact that SAP Marketing Cloud uses them for practically everything, most of the ones we might ever need have already been created. Therefore, if we do not have a very specific requirement for Marketing Cloud that would require development, these existing ones will be sufficient with several adjustments. We’ve already shown how to edit views, even though you may not have noticed it in the blog post How to Create Your Own Fields in SAP Marketing Cloud? At the beginning, we will show one of the possibilities of their use. In particular, how to modify the extended view so that we select only relevant data and make it available using API.
Instructions for Creating CDS View with a Custom Field for Use in Other Systems Using API
In our practical example, we will work with a view that we have previously extended by our own field. Our goal will be to make available the names, email addresses, and VIP status of our customers from the Czech Republic with the GOLD VIP status. Through API for the possibility of use in other systems.
We will find out which view we expanded when creating our own field in the Custom Fields and Logic application as follows.
In the “UIs and Reports” tab, we will display the “Data Source” column
We will copy the name of the view we’ve expanded and move it to the Custom CDS Views application. According to the prefix I_* we can say that it is an Interface view. We will discuss what this means and what other types exist in other parts.
Custom CDS Views
We will create new ones in the Custom CDS Views application
After creating this view, we will name it, select the usage scenario as External API, and add the data source to which we added our own field. In our case “I_Mkt_Contact”.
In the “Field selection” tab, we will select the fields that we want to make available using our API.
In the “Filters” tab, we will narrow the display to contacts from the Czech Republic with the VIP (Custom field) GOLD level. From the Fields menu, we will select the Country field. Then we will select one of the operators (=) and enter the value (‘CZ’) in single quotes. We will add the second filter after “and”. The “or” condition is also applicable. The resulting entry looks as follows.
After saving (Save Draft) this CDS, we can Preview the data that will be accessible using API.
If we are satisfied, we will end our work in this application with the “Publish” button.
We now have our data source ready and tailored to our needs. However, to make it available as API, we have to create also the following items:
- Communication User
- Communication System
- Communication Scenario
- Communication Arrangement
We will create the Communication User in the Maintain Communication Users application. It will be used to authenticate access to our API. Recommendation – write down this name and password so you don’t have to come back here.
Click on “New”, name and confirm by pressing “Create”
In the hostname we enter the address of our system without “https://”
Then we just select our Communication user, which we created in the previous step and save.
In the Custom Communication Scenarios application, we will create a new one and assign CDS created by us as a service.
We will assign it the service (API) that the system created after publishing our Custom CDS View and also confirm it with “Publish” (this process usually takes a while).
After having published the Custom Communication Scenario (status = “Published”), we will open the Communication Arrangements application, where we will also create new ones.
We will name and select our Communication Scenario from the list
Subsequently, we will assign the “Communication System” to this Communication Arrangement, which we have created and copy the address of our API.
We will copy the address of our API and activate it by pressing “Save”.
We can use, for example, Microsoft Excel to verify the functionality of API created in this way.
We will insert the link we copied from the Communication Arrangement.
Excel will prompt you for authentication – we will select “Basic” and enter the name and password of the Communication User created by us.
Then all we have to do is to select our view and load the data into the table, and if the data is correct, we will get the following result, proving the functionality of our API.
Thanks to the use of OData (open data protocol), API created in this way can be used in most current applications. This gives us the flexibility and ability to integrate SAP Marketing Cloud with existing systems.
If you are interested in this article and would like to learn more about SAP Marketing Cloud, follow our blog. If you are interested in certified services and consultations in all areas of SAP Customer Experience, do not hesitate to contact us. Because Experience Matters.
You have successfully subscribed to our mail list.
Too many subscribe attempts for this email address.