Skip to Content
Technical Articles

Extracting keyfigure data through OData API in Integrated Business Planning

This blog provides a step by step information of how Odata API (Open Data protocol Application Program Interfaces) from Integrated Business Planning (IBP) in third party applications.

The example explained in this blog uses the freely downloadable tool Postman to extract the data from the IBP Odata API. The example uses the Odata service: /IBP/EXTRACT_ODATA_SRV. For more information on this Odata API, check the help portal link Here.

Prerequisites:

  1. Ensure that the communication scenario of SAP_COM_0143 is setup with the authentication username and password. This username and password will be used while authenticating from the Odata service.
  2. Download the postman tool and familiarize yourself with this tool.
  3. You have an Excel UI planning view template name which has the key figures that you need to extract from the Odata service. Ensure that this template is simple and only has the data to be extracted. This will be used to generate some of the /IBP/EXTRACT_ODATA_SRV parameters automatically.
  4. You have a communication username and password specified in the communication arrangement app in IBP with the necessary authorizations. View the help document here for further information. Help document

Step 1: Fetch the CSRF token from postman 

Copy the “Service URL/Service Interface” from the communication arrangement app in IBP. Figure 1 below shows the Service URL example.

 

Figure 1: SAP_COM_0143 service URL from the communication arrangement app in IBP.

 

In the postman tool, use the “GET” method and paste the service URL as shown in figure 2.

Figure 2: Fetching the csrf token

Specify the “headers” key as specified in figure 2. the Value should be “FETCH” to fetch a x-csrf-token. Specify the communication username and password for basic authentication in the “Authorization” tab. This username and password should be maintained in the communication arrangement app in IBP.

Click on the “Send” button. Navigate to the results “Headers” section to get the CSRF token as shown in the figure 3. This CSRF token is the unique token through which the data can now be extracted from IBP. Copy it to a notepad for later usage.

Figure 3: Results “Header” section in the postman tool to obtain the token.

Step 2: Obtaining the URL for a Excel UI template from postman.

NOTE:

In this step, you can automatically generate the “$Select”, “$Filter” values. In case you know the format, you can skip this step 2 and manually type these values within the Step 3.

 

Change the Service URL as shown in the figure 4. In the figure 4 example “TESTAUTO” is the name of the Excel UI template. Use the /IBP/READ_TEMPLATE_SRV Odata to read the excel template structure.

Figure 4: Obtain URL based on the Excel UI planning view template name.

In the “Authorization” section specify the communication username and password from the communication arrangement. Specify the token in the “Headers” section.

Click on the “Send” button.

 

You will receive a similar screen as shown in figure 5: Fetching the template URL.

Figure 5: Fetching the template URL.

Copy the template URL highlighted in Figure 5. This template as you can see has the planning level, the key figures that will be extracted and also the filtering criteria.

 

Step 3: Fetching the key figure data from postman.

Copy the URL from step 2 “Headers” section that was explained. Delete the “&amp” from the copied URL. Add this URL to the /IBP/EXTRACT_ODATA_SRV URL.

Execute as shown in the figure 6: Fetching the key figure data.

Figure 6: Fetching the key figure data.

Use the CSRF token and the authorizations tab as previously used to pass the CSRF token and the username and password to the Odata API.

The results are as shown in figure 7 will have the keyfigure data extracted in XML format.

 

Figure 7: Result of the Odata keyfigure extraction.

With any third party application which is capable of calling Odata APIs can now use these steps specified above to extract data into their native applications.

You can now use the Odata APIs in your native applications.

Be the first to leave a comment
You must be Logged on to comment or reply to a post.