This public repository is read-only and no longer maintained.
- Overview
- Technical Details
- Prerequisites
- Set Up the MDC Database
- Build and Deploy the Application on SAP HANA Cloud Platform
- Bind the Application Data Source with the MDC Database and Create a Destination
- Start the Expenses Analyzer for Concur Application
- Set Up the Application in Concur
- Generate and Approve Sample Expenses in Concur
- Additional Information
Expenses Analyzer for Concur is a sample extension application for Concur that runs on SAP HANA Cloud Platform and uses a HANA database. The purpose of the application is to show you analytical information about all expenses in your Concur company.
The application can be either run on the productive SAP HANA Cloud Platform landscape with a dedicated HANA, or the trial landscape with a multitenant database containers (MDC) database. This guide explains how to download, build, deploy and configure the application on the SAP HANA Cloud Platform trial landscape.
These are the SAP HANA Cloud Platform services and features in use:
- Connectivity Service - the application uses the Connectivity Service to obtain connection to Concur.
- Persistence Service - the application uses the Persistence Service to manage its connection to the database.
- Identity Service - the application uses the Identity Service to manage its security.
- Trial MDC database - the application uses an MDC database.
The Expenses Analyzer for Concur is a Java application that performs regular data replication from your Concur company into an MDC database. This data serves as a base for a HANA Analytical View. As a result, you can leverage the computing power of the MDC database, which performs analytical computations on top of expenses data from Concur.
To use this extension application, you need to:
- Adjust the MDC database that it uses.
- Build and deploy the application on SAP HANA Cloud Platform.
- Bind the application to the MDC database.
- Start the application.
- Set up the application in Concur.
You need to:
- provision a Concur sandbox company
- have an SAP HANA Cloud Platform developer account
- have an SAP HANA MDC database started and add the necessary roles described in the Web IDE scenario in the same blog
- download or clone the project with Git
- have set up Maven 3.0.x
In order to set up the MDC database for the Expenses Analyzer for Concur, you need to import a Delivery Unit and create a database technical user dedicated to the application.
In order to import Delivery Units, your MDC user needs the sap.hana.xs.lm.roles::Administrator role. In order to create new MDC users, your MDC user needs the system privilege USER ADMIN. To assign these roles to the user do the following:
- In the SAP HANA Cloud Platform Cockpit, choose your account, go to the Databases & Schemas tab and then choose your HANA MDC database.
- Open the SAP HANA Cockpit and then choose the Manage Roles and Users tile.
- Expand Security > Users and find your user.
- Assign the user the sap.hana.xs.lm.roles::Administrator role from the Granted Roles tab.
- Assign the user the USER ADMIN privilege from the System Privileges tab.
- Save the changes.
You need to import a HANA delivery unit into your MDC database. The delivery unit contains the application schema, tables, roles, and views. It is called EXPENSES_ANALYZER_FOR_CONCUR_TRIAL.tgz
and is available in the project folder cloud-concur-expenses-analyzer-ext\
.
- In the SAP HANA Cloud Platform Cockpit, choose your account, go to the Databases & Schemas tab and then choose your MDC database.
- Open the SAP HANA Cockpit and login with your MDC user.
- Choose the HANA Application Lifecycle Management.
- Choose the PRODUCTS tab.
- Choose the Delivery Units tab.
- Choose Import.
- Select
EXPENSES_ANALYZER_FOR_CONCUR_TRIAL.tgz
that is available in the project foldercloud-concur-expenses-analyzer-ext\
. - Choose Browse to display a file explorer, which you can use to locate the DU you want to import, and choose Open.
You need to [create a technical MDC user] (https://help.sap.com/saphelp_hanaplatform/helpdata/en/c0/555f0bbb5710148faabb0a6e35c457/content.htm) dedicated to the application.
- In the SAP HANA Cloud Platform Cockpit, choose your account, go to the Databases & Schemas tab and then choose your HANA database.
- Open the SAP HANA Cockpit and then choose the Manage Roles and Users tile.
- Expand Security > Users and from the context menu choose New User.
- Enter the username and the password and save the changes.
- Open the new user from the structure on the left.
- Assign the HANA user the role
com.sap.hcp.extensions.concur.trialeac::SHCPExtensionsForConcurTrialEAC
. This role allows the user to insert data into and select data from the table where the expenses are stored. It also allows select on the HANA analytical view.
Note: After creating the technical MDC user, make a single login with this user since the initial password must be changed before using it.
You have already downloaded or cloned the Expenses Analyzer for Concur. Now you have to build the application and deploy it on the SAP HANA Cloud Platform. There are two paths you can choose from:
- using the SAP HANA Cloud Platform Cockpit
- using the Eclipse IDE
-
Go to the
cloud-concur-expenses-analyzer-ext
folder. -
Build the project with:
mvn clean install
The produced WAR file ROOT.war
under target sub-folder cloud-concur-expenses-analyzer-ext\target
is ready to be deployed.
You have to deploy the ROOT.war
file as a Java application via SAP HANA Cloud Platform Cockpit. Use Java Web Tomcat 7 as a runtime option.
Caution: Make sure you only deploy the application without starting it. You need to bind the application to the data source first.
When using the Eclipse IDE you can take a look at the structure and code of the application. You have to import the application as an existing Maven project and build it with Maven using clean install
. You also have to choose Java Web Tomcat 7 as a runtime option.
-
You have to clone the
cloud-concur-expenses-analyzer-ext
project.- Оpen the Git Perspective. Choose Windows > Open Perspective > Other. Select Git and choose OK.
- Choose Clone a Git repository.
- Enter
https://github.com/SAP/cloud-concur-expenses-analyzer-ext.git
in the URI field and choose Next. - Set the Directory field and choose Finish.
-
You have to import the
cloud-concur-expenses-analyzer-ext
project as an existing Maven project and then build it.- In the Java EE perspective, choose File > Import > Maven > Existing Maven Project.
- Browse and select the folder where you have cloned the Git repository and choose Finish. Wait for the project to load.
- From the project context menu, choose Run As > Maven Build.
- Enter
clean install
in the Goals field and choose Run. The build should pass successfully.
To deploy the application from Eclipse IDE, follow these steps:
- In the Servers view right-click on the white field and choose New > Server.
- Select SAP HANA Cloud Platform and choose Next.
- Select Java Web Tomcat 7 as a runtime option.
- Add the
hotels.provider
application to the Configured field and choose Finish.
You need to bind the application data source with the MDC database and create a destination on the SAP HANA Cloud Platform.
- Create a new data source binding for the Java application for the MDC database. Use the MDC database user you already created.
Note: If there is a default data source binding already created, you have to delete it. Make sure the binding is to the MDC database.
1. In the [SAP HANA Cloud Cockpit](https://account.hanatrial.ondemand.com/), go to _Databases&Schemas_ and choose your MDC database.
2. Choose _New Binding_. Enter the Java application you have deployed and enter the credentials of the technical MDC user you have already created.
-
Create an HTTP destination on application level.
Use the following required properties:
Name: concur-api URL: <the url of the Concur instance, e.g. https://www.concursolutions.com/>
And add one additional property:
AccessToken: <an OAuth access token that is about to be created>
After creating the data source binding and the destination, start (or restart in case the application is already started) of the application via the Cloud Cockpit.
The Expenses Analyzer for Concur application requires an OAuth access token for the Concur company. In this way it is able to communicate with Concur on behalf of the company owner. To generate this token you need to:
- register a partner application in Concur and get its application key
- register a technical user in Concur and get its credentials
- generate the OAuth access token using the application key and the user credentials
You can either configure and use the default sandbox partner application or register a new partner application.
You log in Concur using the credentials of the company registered there. You need to have an Administrator authorization to configure partner applications.
- Go to Administration > Company > Web Services > Register Partner Application. You already have the default sandbox partner application there. Double-click on it.
- Set the checkbox Expense Report - Add, Approve, or Update Expense Reports APIs
The partner application comes with an application key that will be used when generating the access token. You can find this key in the Application Authorization section.
If you register a new partner application instead of using the default one, make sure it has permissions to access Expense Report - Add, Approve, or Update Expense Reports APIs.
Again - the partner application comes with an application key that will be used when generating the access token. You can find this key in the Application Authorization section.
You can use the sandbox user or register a new technical user.
You need a technical user in your Concur company, so that the Expenses Analyzer for Concur application can perform regular data replication from this company into a HANA database. The technical user is just a user that is related only to this application.
For test purposes, instead of creating a dedicated technical user, you can use the sandbox user.
You log in in Concur using the credentials of the company registered there. You need to have an Administrator authorization to create a technical user.
- Go to Administration > Setup > Expense.
- In the menu on the left, choose Users and then Create/Edit User.
- These are some of the fields you have to fill in:
- Reimbursement Method: select one of the options from the drop-down menu.
- User Permissions: set all the checkboxes in the Expense section.
- Choose Save and then Done.
You need an access token for your technical user in Concur. This token is used by the Expenses Analyzer for Concur application to communicate with Concur on behalf of the technical user.
The token can be generated via the Concur Native authorization flow.
This is what you have to do:
- Use a REST client of your choice for making the calls. For example, Postman, or other tool.
- Make a GET request with this URL: https://www.concursolutions.com/net2/oauth2/accesstoken.ashx and add two headers:
- X-ConsumerKey header with value the key from the Concur partner application.
- Authorization header must include Base-64 encoded credentials (LoginID:Password) of the Concur technical/sandbox user in the HTTP Basic Authentication format.
You can now fill the generated OAuth access token in the concur-api
destination.
The Expenses Analyzer for Concur uses Concur expenses reports. You need to add and process a few such reports to be able to see them in the Expenses Analyzer application.
You log in in Concur using the credentials of the company registered there.
To be able to create and process expenses reports in a sandbox company, you need one user with rights to submit expense reports and another user with rights to process and approve expense reports. For the purposes of the example, you can use one and the same user for both creating expenses and processing them.
- Open Concur and log in with your Concur user, e.g. the default sandbox user.
- Go to Administration > Setup > Expense.
- Go to the Accounting section. In the Select your accounting software field, select Intuit QuickBooks Desktop: Pro, Premier and Enterprise or Intuit QuickBooks Online options.
- Go to Users, select your user (e.g. the default sandbox user) and then select Create/Edit User. Choose a reimbursement method from the drop-down with the same name and save the changes. The user needs all rights to work with expenses - Can Process Expense Reports, Can Submit Expense Reports, Can Approve Expense Reports.
- Go to Expense > Expense Types > Account Codes and make sure there are account codes entered for a few expense types.
To create and process an expense report, you need to:
- Open Concur and log in with the Concur user that was configured in the previous step (e.g. the default sandbox user).
- From the home screen, go to Expense > Manage Expenses and choose Create New Report.
- Fill in the Report Name field, for example My trip to Berlin. Choose Next.
- Enter some expenses in the report according to your sandbox company setup. Choose Submit Report.
- If the report is in Submitted & Pending Approval state, you need to approve it. Go to Approvals tab, choose expense report you want to approve, and then Approve.
- If the report is in Approved & In Accounting Review, you need to process it. Go to Expense > Process Reports tab, choose the report you want to process, and then Change Approval Status. Select Approved and then choose Save.
- Go to Administration > Company > Tools > Payment Manager. Find the newly created batch and select close now.
The report is now closed and available for the Expenses Analyzer application.
- SAP HANA Cloud Documentation - https://help.hana.ondemand.com/
- Concur API - https://developer.concur.com/api-reference/index.html
© 2016 [SAP SE](http://www.sap.com/)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this work except in compliance with the License.
You may obtain a copy of the License in the LICENSE file, or at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.