This document explains us about how to create an outbound interface using Interface Execution Scheduler functionality with SAP PI/PO using SFDC2SAPPI Adapter
Interface Execution Scheduler – #
This scheduler is only used with the outbound interface and is generated automatically for any outbound interface inside an integration. It uses the SOQL in the field “SOQL Query for filter sObject”. In this field, the user can write the SOQL statement which filter sObject to be passed on the method invokeCallout2(). The scheduler uses the method invokeCallout2() to execute the outbound interface. If the SOQL is not powerful enough to solve the requirement of a customer then they can use apex class to write their own logic for data selection. Then the flag “Use Apex Class” has to be set and in the field “Apex Class for Filter sObject” an apex class has to be specified.
We have two test cases in this functionality
Case 1:- Callout data to SAP with SOQL Query to filter sObject by using InterfaceExecution schedule processing.
Case 2:- CallOut data by using apex class for filter sObject.
Configuration for Case 1:
Create Inbound interface as shown below
In this inbound interface, we need to use the Id as the external Id. This Id is needed to update and the record id which was found by the filter query SOQL. If we don’t use the Id field of the sObject it will not work.
Add the outbound interface as invoke inbound/outbound interface in the inbound interface
Do the mapping as shown below.
Create an Outbound Interface –
Select Operation type- query/ PullQuery.
Processing mode- Asynchronous.
Select Outbound Adapter
In Section “SOQL Query for filter sObject”
Filter Query:- SELECT Id FROM Account WHERE BillingCity = ‘PhnomPenh’ AND skyvvasolutions__SAP_Sales_Org__c = ”
Interface to change condition:- Enter Inbound Interface ID.
In section “SOQL Query to select sObject data” or by using “Query Editor” we can write the query:-
Do the mapping as shown below.
Download the outbound interface WSDL and import it into SAP PO for mapping.
- Designing the objects in ESR
Import the Account WSDL as external definition into ESR and save activate it
As we sending data to SAP. Here we are using DEBMAS07 Idoc as a target structure. Import Idoc from SAP and activate it.

Create message mapping as shown below
Create Operation mapping as shown below
Creation of Integrated Configuration Objects
After creating the objects in ESR. We have to configure these objects in the integration directory.
First, we have to create Configuration Scenario.
An Integration scenario has the following objects.
- Business System for Sender and Receiver
- Sender and Receiver Communication channel
- Integrated Configuration
We have to define our business system e.g. for the SAP-Backend. For Salesforce you can use our proposal “Salesforce” as the business system. We have to import these business systems from SLD.
Configuring the Sender SOAP communication channel
Create sender communication channel as shown below.
Since we are using Salesforce as a source. So, here we are using SOAP in the sender channel.
Provide the necessary details as shown and then save and activate the channel.
- Configuring the IDOC receiver channel
Integrated Configuration
Create integrated configuration objects as shown below.
Enter the required data e.g. the Communication Component, Interface and Namespace and then click on create button to create an ICO.
Now go through the tabs from left to right to configure the relevant objects. In this first tab “Inbound Processing” here we have to specify the sender communication channel.
Here in the “Receiver” tab, we have to specify the receiver business system.
In Receiver interfaces tab specify the operation mapping.
In the “outbound processing” tab, we have to specify the receiver channel.
Test the Outbound Interface.
On the Integration page Select the “Scheduler” tab.
Check the section “Scheduler Per interface”.
Run the “Interface execution Scheduler” as shown in the given picture below.
Check the result on Message Monitoring For Case 1 once InterfaceExecution scheduler processed – #
Configuration for Case 2:
Configuration for the inbound interface will be the same as case 1.
Configuration for the outbound interface is given below.
- In Section “SOQL Query for filter sObject”
- Check the box of Use the apex class.
- Interface to change condition:- Enter Inbound Interface ID.
#
Create a custom apex class with the code given below:-
Global with sharing class InterfaceCustomClass implements skyvvasolutions.CustomInterfaceObjectCallout {
Global map<Id, SObject> getMapObject(){
map<Id, Account> ActMap = new map<Id, Account>([SELECT Id,BillingCity,BillingCountry,Name,SAP_Sales_Org__c FROM Account where BillingCity=’PhnomPenh’ AND SAP_Sales_Org__c =”]);
system.debug(ActMap);
return ActMap;
}
}
To add the above code we just need to go to Setup and the Apex classes and then click on new to create a new custom apex class
Run the “Interface execution Scheduler” as shown in the given picture below.