SAP Concur – Retrieving Receipt Images for a specific Country
2023-11-10 22:25:0 Author: blogs.sap.com(查看原文) 阅读量:8 收藏

I have been a Technical Consultant at SAP Concur for quite some time and have worked with many clients to help them build their interfaces between their systems and SAP Concur. One requirement I regularly see come up is to maintain a local archive of receipt images in that country.

In this blog we are focusing on the use case where you may need to retrieve Expense Receipt Images for a particular country. There are several ways of getting Expense Receipt Image files from SAP Concur. These include:

  • Image Delivery Extract
    A zip-file delivered via SFTP in a predefined format. It does not allow for any country filtering.
  • SAP Integration with Concur Solutions (ICS) for SAP ERP Systems
    Allow you to define an image archive location within the SAP ERP system. Once setup the receipt images are retrieved as part of the FI posting.
  • Web Service APIs
    Allows you to retrieve images based on filter criteria through a series of calls from a program to extract the data for immediate consumption. This is an excellent of retrieving receipt images for a local country archive when other standard methods cannot fulfill your requirements. This will be the focus of this blog-post.

Prerequisites

This post will not discuss authentication with Concur Expense.  Please see this post to get an explanation on authentication and application building within Concur Expense.  You will need an application with the following SCOPEs:

  • EXPRPT
  • IMAGE

Receipt Images can be downloaded by Expense Report. All receipt for the Expense Report will be compiled into a single PDF-file. You can filter the Report list on certain criteria result by using the parameters on the Reports v3 API to ensure the result only returns the relevant reports to download images for.

Steps

  • Get Report list based on filter criteria
  • Get Image per Report ID
  • Get Image file

Sequence%20diagram

Sequence diagram

To help you understand APIs used in this use case, I developed the following Postman collection (found here) as an example.  More detail on the APIs used can be found on the SAP Business Accelerator Hub:

Get Report list based on filter criteria

The first step is to retrieve all the expense reports for which we need to get the receipt images. For this we can use the Reports v3 API – GET /api/v3.0/expense/reports . By adding query parameters we can filter the result. For example, if we want to see all expense report (1) from Italy (2) that have images (3) and have been sent for payment on 13 June 2023 (4), we could use the following parameters:

  1. user=ALL
  2. countryCode=IT
  3. hasImages=TRUE
  4. paidDateBefore=2023-06-14&paidDateAfter=2023-06-13

The actual GET call would then look like this:

GET /api/v3.0/expense/reports?user=ALL&countryCode=IT&hasImages=TRUE&paidDateBefore=2023-06-14&paidDateAfter=2023-06-13

In the result, each Expense Report will include an element “ID”, which is the Report ID.

Further detail about the available filter criteria can be found here.

Get Image per Report ID

For each Expense Report you can then use the Image v1 API to get a URL from where you can download a PDF-file with all images for that single report. Since this is per Report ID, you will need make this GET-call for each Expense Report.

GET /api/image/v1.0/report/{reportId}

The response will contain a URL that can be used to retrieve the actual image file. This URL is valid for 15 minutes after the request.

Get Image file

To get the Receipt Image file, you can call a direct GET to the URL that was returned in the previous step. Any parameters the URL includes will need to be included as well. This URL could look something like this:

https://www-us2.api.concursolutions.com/imaging/web/us2/file/p0099999xyzz/5E5B592E3F9F0B100736275DAED2195D22C849B0A5A61132E92CB8C21C3F558FDE2F54EBFD945E7568485E38AF269CFDF40158AC23BC63C7910C6DDD0332580F003659C527HA20C77ECAFF57EE130AE7F311BF8DF5B?id=3B9830636ADA49D791FA&e=p0099999xyzz&t=AN&s=ConcurConnect

Combining SAP Concur’s Reports v3 and Image v1 APIs offer a very flexible way to retrieve Receipt Images based on relevant filter criteria. This allows you to specifically target only those images that you need to store in a local archive.

What do you think?  Do you have anything to add? Leave a comment below.

Did you find it useful? Give us a like and share on social media.

Want to know more about SAP Concur? Please follow here.

Want to ask questions about SAP Concur and its offerings? Ask here

Follow my profile for similar content.

Thank you!


文章来源: https://blogs.sap.com/2023/11/10/sap-concur-retrieving-receipt-images-for-a-specific-country/
如有侵权请联系:admin#unsafe.sh