Illustrates how to use Mule Runtime to build a simple HTTP application using APIKit to fetch data from SAP. After reading this document, creating and running the example in Mule, you should be able to leverage what you have learned to create an HTTP request-response application that is able to retrieve requested data from your SAP instance.
This example can also be used while configuring any of our Anypoint SAP Templates for retrieving Customers / Materials / Sales orders data
This application uses the APIKit Router component to route HTTP requests to the exact flow defined by resource and method. The application then prepares an XML request for the SAP connector using the HTTP input parameters. The response is then transformed to JSON and returned to the user.
Set Up and Run the Example
As with other examples, you can create template applications straight out of the box in Anypoint Studio. You can tweak the configurations of these use case-based examples to create your own customized applications in Mule.
Follow the procedure below to create, then run the SAP data retrieval application.
- Open the Example project in Anypoint Studio from Anypoint Exchange.
- Go to Global Elements and open SAP Connector element. Fill in your SAP credentials.
- Run the application.The APIKit console should start and you can choose which endpoint you want to call.
- GET /customers - Returns customer data from a SAP instance according to the specified parameters. Users are able to define two HTTP query parameters - maxcount, name.
- maxcount - Defines the maximum count of the retrieved customers.
- name - Defines the String that the customer's name have to start with.
- GET /materials - Returns materials data from SAP instance according the specified parameters. Users are able to define two HTTP query parameters - maxcount, name.
- name - defining the String that the material's name have to start with
- maxcount - Defines the maximum count of the retrieved materials.
- GET /salesOrders - Returns sales orders data from SAP instance according the specified parameters. Users should define two HTTP query parameters -customernumber, salesorganization
- customernumber - Specifies the customer number for sales orders.
- salesorganization - Specifies the sales organization for sales orders.
- Click the resource which you want to use, specify the parameters and click the GET button.
- The retrieved data structure appears. If the data in SAP instance does not match your criteria, "No data found" message is returned.