Use the Extract API in a Scheduled Orchestrated Integration

This use case provides a high level overview of how to submit a job, get job status, and retrieve the extract data of the job created by using the SAP Concur Adapter Extract API.


Description of concur_int_oview.png follows
Description of the illustration concur_int_oview.png
  1. Select and configure the SAP Concur Adapter on the Connections page.

  2. Create a scheduled orchestrated integration.

  3. Drag the SAP Concur Adapter into the integration as an invoke connection.

    1. On the API Option page, select Extract API.

      This API enables you to request the extract of available data objects, such as approved expense reports, travel requests, and payment requests.

    2. On the Operations page, select SumbitJobRequest from the Select Operation list to configure the SAP Concur Adapter to submit the job.

  4. In the request mapper, map startTime to POST.


    Description of concur_extract_map1.png follows
    Description of the illustration concur_extract_map1.png
  5. Add an assign activity.

    1. Create two variables to store the status of the job (for this example, named done) and a file link to retrieve the file (for this example, named Filelikvar).

  6. Configure a while action below the assign action to check the status for the submitted job.

    1. Configure the condition for the status (“done! =2”).


      Description of concur_extract_while.png follows
      Description of the illustration concur_extract_while.png

      Note:

      The status of the job is 2 if the job is completed. This is returned by SAP Concur.
  7. Drag a second SAP Concur Adapter inside the while loop and configure the adapter to get the job status.

    1. On the API Option page, select Extract API.
    2. On the Operations page, select GetJobStatus from the Select Operation list.

  8. Map status-link from the SubmitJobRequest operation’s response to JobStatusLink in the request of the GetJobStatus operation.


    Description of concur_extract_map2.png follows
    Description of the illustration concur_extract_map2.png
  9. Drag a switch action into the integration.

    1. Configure the condition for the status variable to check the job status.

  10. Drag an assign action in the switch action to update the status.

    If the status is completed (that is, status = ”2”), it is updated in the variable created in Step 5.


    Description of concur_extract_assign.png follows
    Description of the illustration concur_extract_assign.png
    1. Update done to status and Filelikvar to file-link.


      Description of concur_extract_assign2.png follows
      Description of the illustration concur_extract_assign2.png
    2. In the Otherwise condition of the switch action, drag a wait action.

    3. Configure the wait action to wait for 2 minutes.

  11. Drag a third SAP Concur Adapter connection outside of the while action.

    1. On the API Option page, select Extract API.

    2. On the Operations page, select the RetrieveFile operation. The RetrieveFile operation downloads the file to a virtual file system (VFS) directory. The VFS location of the downloaded file is returned in the response of the RetrieveFile operation along with the file(s) name.

  12. In the mapper, map $Filelikvar to file-link.


    Description of concur_extract_map3.png follows
    Description of the illustration concur_extract_map3.png
  13. Drag a for-each action into the integration.

    1. Name the activity (for this example, foreach is entered).

    2. Drag the files element from the response of RetrieveFile to the Repeating Element field.

    3. Enter a name in the Current Element Name field (for this example, FileTemp is entered).


      Description of concur_extract_foreach.png follows
      Description of the illustration concur_extract_foreach.png
    4. Click Create and complete for-each action configuration.

  14. Drag a stage file action inside the for-each action to read the downloaded result.

    1. Provide a name, and then click Next.

    2. Select Read Entire File from the list.

    3. In the Specify the File Name field, provide the file name for the stage file action response.


      Description of concur_extract_stage_fi.png follows
      Description of the illustration concur_extract_stage_fi.png
    4. For the Specify the Directory to read from field, provide a file location.

      The Configure Operation page looks as follows.


      Description of concur_extract_stage_f2.png follows
      Description of the illustration concur_extract_stage_f2.png

      You now create a schema based on the sample headers mentioned on the Summary page of the SubmitJobRequest operation for each extract.

    5. On the Schema Options page, select Create a new schema from a CSV file, which maintains the response file structure.

    6. On the Schema Options page, select the CSV file.

    7. Check the configuration in the Summary page.

  15. Drag an FTP Adapter connection below the stage file action configured to read the retrieved files.

    1. On the Operations page, select the Write File operation.

    2. On the Schema page, select to create a new schema.

    3. On the Format Definition page, select a sample CSV file that maintains the response file structure (for this example, InvoiceGLEExtract.csv is selected). This is the same CSV file selected for the stage file action.

  16. In the mapper, map the stage file action response elements to FTP Adapter request elements.


    Description of concur_extract_map4.png follows
    Description of the illustration concur_extract_map4.png
  17. Add the tracking variable:

    1. In the upper-right corner, select Tracking from the Actions menu.

    2. Drag a tracking variable.

  18. Save and close the integration, which looks as follows:


    Description of concur_extact_int.png follows
    Description of the illustration concur_extact_int.png
  19. Activate the integration.

  20. From the Actions menu at the far right for this integration, select Submit Now.

    You receive a run ID. You can monitor the flow using this run ID.

    The integration is deployed and the web service is ready to accept requests.