- Go to your SAP Integration Suite tenant. Select Design -> Integrations. Navigate to Artifacts tab of the newly created integration package. Select Add and select Integration Flow from the drop-down menu.
- You can provide a Name for your Integration flow in the Add Integration Flow dialog. Enter Consume SAP Concur API in the Name field and select OK.
- Select the newly created Integration flow named Consume SAP Concur API
- and then select Edit to start editing the integration flow.
- Since a timer-based integration flow will be used the default start message and Sender can be deleted.
- Select the default Sender and select Delete
- Select the default Start message and select Delete icon.
- Select and add the Timer integration step. The default property of timer integration step is to execute the integration flow immediately after you deploy the integration flow. More about the available timer configurations is available in help documentation.
It should be used as a subprocess integration flow that is called by another Integration flow on the SAP Cloud integration to retrieve data from any SAP Concur API with a GET request.
- To establish inter-communication between integration flows we can use the Request Reply integration pattern with an ProcessDirect adapter. Search and Select Request Reply from integration palette and drop it into Integration Process.
- Change the name of Request Reply step to Get Expense Report in the General tab to improve readability.
- Select and connect the Get Expense Report integration step to the Receiver.
- This would open the Adapter list. From the available Adapter select ProcessDirect in the Adapter Type option dialog.
The Integration Flow which we have copied from the Catalog is a Consumer Integration Flow using ProcessDirect adapter you can consume it from other integration flow.
- Under the Connection tab, enter Address as /Concur/API.
- Search and Select Groovy Script from integration palette and drop it into Integration Process canvas.
- Select the Groovy Script 1 Integration flow step and select the Create script icon.
-
In the script editor, you can specify the script according to the requirements of your scenario. For an overview of the classes and interfaces supported by the Script step, see SDK API. For more information on how to use the dedicated interfaces and methods for specific use cases, refer to Script Use Cases.
This is the Groovy script you can use to push the message log to the Response Payload. Copy and Paste it to script editor. Copy & Paste it.
import com.sap.gateway.ip.core.customdev.util.Message;
import java.util.HashMap;
def Message processData(Message message) {
def body = message.getBody(java.lang.String) as String;
def messageLog = messageLogFactory.getMessageLog(message);
if(messageLog != null){
messageLog.addAttachmentAsString("ResponsePayload:", body, "text/xml");
}
return message;
}
When you’ve finished the definition of your script, click OK