SAP Integration Application Guide
This guide outlines the integration process for incorporating SAP records into NextBillion's Route Optimization API using the Retool development suite.
Step 1: SAP Records Retrieval
To retrieve customer records and their address details from SAP, execute the following cURL command:
The response will contain an array of customer records with address details in JSON format.
The subsequent cell visualizes the above API response.
![SAP Records Retrieval](https://static.nextbillion.io/docs-next/integrations/sap/image-13.webp)
Step 2: Vehicle Records
In this integration, we employed randomly generated vehicles. The CSV-formatted details of these vehicles were uploaded to the Database and leveraged for optimization. Users have the flexibility to integrate their own fleet/vehicle records into the optimization process. If vehicle records are available in SAP, they can be seamlessly pulled and incorporated into the optimization workflow.
The following image visualizes the vehicles dashboard.
![Vehicle Records](https://static.nextbillion.io/docs-next/integrations/sap/image-14.webp)
Step 3: Integration with Route Optimization API
Following the successful retrieval of essential data from SAP, seamlessly integrate the fetched information with Route Optimization using the specified API endpoint. Effectively map the SAP data to the relevant API parameters and configure optimization settings, including shift start and end times, as well as service times.
This code snippet manages the integration process, ensuring a smooth connection between SAP data and Route Optimization API.
Step 4: Create Optimization Jobs
Initiate the creation of optimization jobs by sending a POST request to NextBillion.ai's Route Optimization API with specified parameters. Confirm the successful job creation through the received API response.
Here's an example of the POST query using cURL:
Upon successful execution, the API response will confirm the creation of the optimization job:
This response provides essential information, including the job ID, a confirmation message, and the status 'Ok,' indicating the successful creation of the optimization job.
Step 5: Optimized Route Result Retrieval
Retrieve the optimized route result by making a GET request to the NextBillion.ai Route Optimization API with the job ID and API key.
Below is an example of the GET query:
Upon successful retrieval, the API responds with a JSON structure, providing crucial details about the optimized route. Here's an example of the JSON response:
This response includes detailed information such as total cost, the number of routes, service and duration metrics, and individual steps for each route, offering a comprehensive overview of the optimized route result.
Step 6: Visualize Optimized Routes
After successfully fetching the data and setting up the Route Optimization API, initiate the API to generate optimized routes. To visualize the generated routes, you can view them on NextBillion's Optimizer using the following link:
This link directs you to the Optimizer interface, providing a convenient way to inspect and analyze the optimized routes generated by the Route Optimization API. Simply replace the placeholders with your API key and the request ID obtained from the API response for seamless integration and route assessment.
Below is a snippet showcasing the visual representation of the generated routes within the tester interface.
![Visualize Optimized Routes](https://static.nextbillion.io/docs-next/integrations/sap/image-15.webp)
Step 7: Retrieve Optimization Results in SAP
To access the outcome of the optimization process within the SAP system, employ a GET request. In your SAP instance, craft a GET request with the specified details:
This request will retrieve the optimization results from NextBillion.ai and integrate them seamlessly into your SAP environment. Ensure that you replace <Optimization Result ID>
and <NextBillion.ai API Key>
with the corresponding values for your specific optimization run.
Upon successful execution, the JSON response within SAP will contain the detailed optimization results, providing valuable insights into the routes and associated data generated by the optimization process.
![Retrieve Optimization Results in SAP](https://static.nextbillion.io/docs-next/integrations/sap/image-15.webp)
SAP, with its extensive capabilities, offers a multitude of integration possibilities. This guide outlines one approach to seamlessly integrate SAP with NextBillion's Route Optimization API. While the SAP Integration Suite provides a robust toolkit for integrating diverse applications and systems, it's essential to note that it's not the sole method for integration. There are alternative methods and technologies available, and the choice depends on your specific SAP system.
Selecting the appropriate integration method hinges on your unique requirements and existing infrastructure. SAP offers a range of options to cater to various integration scenarios, allowing you to choose the approach that aligns best with your needs.