OutSystems Platform allows you to fetch data from SAP and use it in your OutSystems applications.
The steps you take to add an SAP function to get data are:
In this example we will create an application that list customers stored in SAP.
We are going to develop a module to list customers from SAP, called SAPCustomers. This module is part of the Order Management application to manage orders.
To import a SAP remote function to get customers, first you need to create a connection to the SAP system.
To establish a connection to SAP, go to the Logic tab, and open the folder Integrations. Right-click on the SAP item and select 'Consume SAP Remote Functions...'.
A window to configure the SAP connection will be displayed. Fill the fields regarding the connection and login parameters of your SAP. Test your connection by clicking on the Test Connection button. If your connection fails, you can click on 'Show error detail' to see the error message.
After setting the connection to SAP we can now import the SAP functions that we will use in our application.
Click on the Choose Functions button. A folder tree view with the remote functions, grouped by business use case and SAP functionality, is displayed. We need to pick the 'BAPI_CUSTOMER_GETLIST', the function to fetch the customers we want to list. Click on the function name to see its details on the right hand panel: description, input, and output parameters.
Check the function and click 'Finish'.
The Bapi_Customer_Getlist action is created and the structures to define the parameters: Addressdata, Idrange, Return, and Specialdata. See more about how structures are created and data type conversions between SAP and OutSystems Platform.
The action for the remote function will be available under the SAP connection you've configured, inside the SAP element.
You can now create the logic and list customers in your application. Use the Preparation action to implement the logic to fetch the customers from SAP.
To get customers between id 1 and 1000, assign the following values to a variable with the BAPICUSTOMER_IDRANGE data type of the Bapi_Customer_Getlist action:
The credentials used in this call are the ones defined in the connection set up. See other authentication methods.
You can now list customers on a web screen:
Publish and open in the browser.
Troubleshoot SAP Remote Functions | Change Data in an SAP System