Skip to content
This repository has been archived by the owner on Dec 17, 2020. It is now read-only.

А sample extension application for Concur that runs on SAP HANA Cloud Platform and uses a HANA database

License

Notifications You must be signed in to change notification settings

SAP-archive/cloud-concur-expenses-analyzer-ext

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Important Notice

This public repository is read-only and no longer maintained.

Expenses Analyzer for Concur

Content:

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:

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:

  1. Adjust the MDC database that it uses.
  2. Build and deploy the application on SAP HANA Cloud Platform.
  3. Bind the application to the MDC database.
  4. Start the application.
  5. Set up the application in Concur.

You need to:

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:

  1. In the SAP HANA Cloud Platform Cockpit, choose your account, go to the Databases & Schemas tab and then choose your HANA MDC database.
  2. Open the SAP HANA Cockpit and then choose the Manage Roles and Users tile.
  3. Expand Security > Users and find your user.
  4. Assign the user the sap.hana.xs.lm.roles::Administrator role from the Granted Roles tab.
  5. Assign the user the USER ADMIN privilege from the System Privileges tab.
  6. Save the changes.

Import HANA Delivery Unit

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\.

  1. In the SAP HANA Cloud Platform Cockpit, choose your account, go to the Databases & Schemas tab and then choose your MDC database.
  2. Open the SAP HANA Cockpit and login with your MDC user.
  3. Choose the HANA Application Lifecycle Management.
  4. Choose the PRODUCTS tab.
  5. Choose the Delivery Units tab.
  6. Choose Import.
  7. Select EXPENSES_ANALYZER_FOR_CONCUR_TRIAL.tgz that is available in the project folder cloud-concur-expenses-analyzer-ext\.
  8. Choose Browse to display a file explorer, which you can use to locate the DU you want to import, and choose Open.

Create a technical MDC user

You need to [create a technical MDC user] (https://help.sap.com/saphelp_hanaplatform/helpdata/en/c0/555f0bbb5710148faabb0a6e35c457/content.htm) dedicated to the application.

  1. In the SAP HANA Cloud Platform Cockpit, choose your account, go to the Databases & Schemas tab and then choose your HANA database.
  2. Open the SAP HANA Cockpit and then choose the Manage Roles and Users tile.
  3. Expand Security > Users and from the context menu choose New User.
  4. Enter the username and the password and save the changes.
  5. Open the new user from the structure on the left.
  6. 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

Build the Application

  1. Go to the cloud-concur-expenses-analyzer-ext folder.

  2. 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.

Deploy the Application Using the Cockpit

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.

Prerequisites

Build the Application from Eclipse

  1. You have to clone the cloud-concur-expenses-analyzer-ext project.

    1. Оpen the Git Perspective. Choose Windows > Open Perspective > Other. Select Git and choose OK.
    2. Choose Clone a Git repository.
    3. Enter https://github.com/SAP/cloud-concur-expenses-analyzer-ext.git in the URI field and choose Next.
    4. Set the Directory field and choose Finish.
  2. You have to import the cloud-concur-expenses-analyzer-ext project as an existing Maven project and then build it.

    1. In the Java EE perspective, choose File > Import > Maven > Existing Maven Project.
    2. Browse and select the folder where you have cloned the Git repository and choose Finish. Wait for the project to load.
    3. From the project context menu, choose Run As > Maven Build.
    4. Enter clean install in the Goals field and choose Run. The build should pass successfully.

Deploy the Application from Eclipse

To deploy the application from Eclipse IDE, follow these steps:

  1. In the Servers view right-click on the white field and choose New > Server.
  2. Select SAP HANA Cloud Platform and choose Next.
  3. Select Java Web Tomcat 7 as a runtime option.
  4. 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.

  1. 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.
  1. 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.

Configure and Use the Default Sandbox 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.

  1. Go to Administration > Company > Web Services > Register Partner Application. You already have the default sandbox partner application there. Double-click on it.
  2. 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.

Register a new Partner Application (optional)

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.

Use the Sandbox User

For test purposes, instead of creating a dedicated technical user, you can use the sandbox user.

Register a Technical User (optional)

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.

  1. Go to Administration > Setup > Expense.
  2. In the menu on the left, choose Users and then Create/Edit User.
  3. 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.
  1. 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:

  1. Use a REST client of your choice for making the calls. For example, Postman, or other tool.
  2. 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.

  1. Open Concur and log in with your Concur user, e.g. the default sandbox user.
  2. Go to Administration > Setup > Expense.
  3. 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.
  4. 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.
  5. 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:

  1. Open Concur and log in with the Concur user that was configured in the previous step (e.g. the default sandbox user).
  2. From the home screen, go to Expense > Manage Expenses and choose Create New Report.
  3. Fill in the Report Name field, for example My trip to Berlin. Choose Next.
  4. Enter some expenses in the report according to your sandbox company setup. Choose Submit Report.
  5. 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.
  6. 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.
  7. 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.

© 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.

About

А sample extension application for Concur that runs on SAP HANA Cloud Platform and uses a HANA database

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •