Blog Post

Integrate SAP Concur API with SAP Cloud Integration

April 17, 2024

Introduction

Getting real-time information and optimizing procedures are critical in today's corporate environment. This is particularly true for cost management, as manually entering data by hand can be laborious and prone to mistakes. The SAP Concur API can be accessed by utilizing SAP Cloud Integration (SCI), as this blog article explains. With the help of this strong connectivity, you can easily link your SAP Concur system to other business apps, automating data interchange and providing access to important financial data.

Benefits of Consuming SAP Concur API with SAP Cloud Integration

  • Enhanced Automation: Automate manual data entry tasks associated with expense reports, invoices, and employee travel requests.
  • Improved Visibility: Gain real-time insights into your company's spending patterns, allowing for better budgeting and cost control.
  • Streamlined Processes: Eliminate data silos and manual processes, improving overall efficiency and reducing processing times.
  • Error Reduction: Minimize data entry errors by automating data exchange between SAP Concur and other applications.
  • Simplified Compliance: Facilitate easier compliance with regulatory requirements by ensuring accurate and consistent financial data.

Step-by-Step Guide

In today's tutorial we will generate the Access Token for SAP Concur API using Cloud Integration.

We will follow the guide from SAP official documentation - SAP Concur.

The Pre-Requisites we needed for the entire scenario is the client id, client secret and grant type.

  1. Client ID - The client applications client_id supplied by App Management.
  2. Client Secret - The client applications client_secret supplied by App Management.
  3. Grant Type - The grant type instructs the Oauth2 service how to process the request.

This all information has to be passed as the Post Body, but in "x-www-form-urlencoded". Our Agenda is to generate the access token and store it in the global variable. Now, let us see how to generate the access token in Cloud Integration.

The entire integration flow will look like this as shown in image below.

The Integration flow

Now let us understand the entire integration flow in Step by step process.

Step 1: Fetch User Credentials

To generate the access token, we need the client id and client secret, which we can store in the exchange property of the content modifier, but it is not good way to do it, so we store the credentials in User_Credentials which we will fetch.

  1. Create the User Credentials in Security Material. The Client_Id will be the username and the Client_Password will be the password.
  1. Add the Groovy Script in the integration flow and fetch the username and password from the User Credential.
  2. Checkout the following script to fetch the user credential using groovy script.

Now we have stored the credentials in the properties. The next step is very crucial. Since we have to send the Client id and Client Secret as the Post body in the format of x-www-urlencoded, we have to write again a script.

Step 2: URL Encoder Script

Add the Groovy Script o the integration flow and the add the following script. This script will convert the credentials into the required format.

Now we have stored the required format credentials in the properties name, client_id and client_secret respectively. Next we have to start building the structure and define the headers and body which we will do using Content Modifier.

Step 3: Content Modifier

  1. Add the Message Header to the Content Modifier as  
    • Content Type - application/x-www-form-urlencoded
  2. Define the Content Body as the
    • grant_type=client_credentials&client_id=${property.client_id}&client_secret=${property.client_secret}

Now our structure is ready and we have to connect the target api usoing Request Reply.

Request-Reply

  1. Add the Request Reply to the integration flow and connect with receiver using HTTP adapter.
  2. Add the required details as shown in the following image.

Now we will get the information from the target api in the form of JSON, Since we will get various information like

{
 
"expires_in": "3600",
 
"scope": "app-scopes",
 
"token_type": "Bearer",
 
"access_token": "access_token",
 
"geolocation": "https://us.api.concursolutions.com"
}

Now, our agenda is to take only access_token and store it in variable, so we will convert the following into XML using JSON to XML Converter.

The next step is to store the access token in the property using Content Modifier.

Add the Content Modifier in the Integration flow and add the Exchange Property.

Step 4: Write Variable

Add the Write variable function to the integration flow and add the following details as shown below.

Step 5: Save, Deploy Monitor

  1. Save the Integration flow and Deploy it.
  2. Open you variables tile under Manage Stores, you will see the variable created "access_token_value"
  3. Click on it and you can view content stored in it as the access token, generated.

Exploring SAP Concur API Resources

Summary

By leveraging SAP Cloud Integration to consume the SAP Concur API, you can unlock a world of automation, improved visibility, and streamlined processes within your expense management system. This translates to significant time savings, reduced errors, and better control over your company's finances.

FAQ

What are the prerequisites for consuming the SAP Concur API with SAP Cloud Integration?

The prerequisites you need as defined below:

  • You'll need access to an SAP Cloud Integration tenant with appropriate permissions for building and deploying integration flows.
  • An SAP Concur account with access to the desired API functionalities is required.
  • Familiarity with SAP Cloud Integration concepts and data mapping techniques is beneficial.

Are there any security considerations when using the SAP Concur API with SAP Cloud Integration?

Absolutely. Secure authentication is critical. You'll create a credential artifact within SAP Cloud Integration to store your SAP Concur API credentials securely, eliminating the need to embed them directly in the integration flow.

What types of data can be exchanged using this integration?

The SAP Concur API offers a wide range of functionalities. You can exchange data related to expense reports, invoices, employee travel requests, and more, depending on your specific requirements.

Do I need coding skills to consume the SAP Concur API with SAP Cloud Integration?

While coding expertise isn't mandatory, it can be helpful for complex integration scenarios. SAP Cloud Integration offers a visual interface for building and configuring integration flows, making it accessible to users with a basic understanding of the platform.

LinkedIn 
Forbes Technology Council, Official Member (2022)
LinkedIn
Forbes Technology Council, Official Member (2022)

About the Author

Jaspreet is an Executive Consultant with expertise in SAP, SaaS/Cloud Integrations, Cyber Security and Data Science. Jaspreet is hands-On Architect who does Pre-Sales, Solution Architecture, Development, Lead Delivery of Complex Integration programs, Manage disperse teams and Ensure successful Project Go-Live/Goals. He has made a lasting impact on global businesses IT projects including Aflac, Advanced Energy, Donnelley Financial Solutions(DFIN), Dell EMC and many more.

Do you want to
learn more about integration?

We are dedicated to make our knowledge accessible. You can either figure it out by yourself or you can let us give you a hand.

Let us take care of your integration.

We are SAP Certified and we can make your project happen. Explore our services and contact us. We will be happy to take on your project.

View Our Services