Describing available APIs

Objective

After completing this lesson, you will be able to describe available APIs

SAP IBP APIs

The SAP Integrated Business Planning, add-in for Microsoft Excel offers multiple APIs to use through Microsoft Visual Basic for Applications (VBA) coding.

Initially, several APIs were made available with the 2005 version. As of the versions 2202.2.0 and 2205.2.0, additional APIs were provided to make basic functions of the Microsoft Excel add-in accessible through VBA coding. Examples include:

  • Trigger the main actions: save data, simulate and refresh
  • Retrieve and manipulate the attribute-based filter settings of a planning view
  • Determine the attribute values of specific cells in a planning view
  • Clear filter values
  • Get master data types
  • Get single master data
  • Update single master data

New APIs continue to be released. They are highlighted in the What's New Webinar series and are listed in the Help. Examples are also available on GitHub. The GitHub repository contains several VBA samples to illustrate existing use cases and capabilities.

Using APIs should not lead to performance degradation. Users can expect the same response with the API as when using the function of the Microsoft Excel add-in.

By default, the newly provided APIs are disabled. To enable them, you must change the global configuration parameter EXCEL_PLANNING_VIEW_APIS in the parameter group PLAN_VIEW from NONE to one of the following parameter values:

  • Read: APIs to change the planning view definition are enabled and can be used via VBA coding.
    • (enabled APIs: Refresh, GetFilterValues, SetFilterValues and GetAttributeValues)
  • Simulate: APIs to simulate data changes including APIs to change the planning view definition are enabled and can be used via VBA coding.
    • (enabled APIs: all APIs mentioned in Read and Simulate)
  • Save: APIs to persistently save data changes are enabled in addition to all other APIs and can be used via VBA coding.
    • (enabled APIs: all newly provided APIs and SaveData)

VBA Samples

The APIs can be used to enhance planning view templates through VBA coding to build their own business logic, and automate some of the manual steps planners must do in their daily work.

As a starting point for the implementation, GitHub contains artifacts that can be used as a starting point to explore the capabilities of the APIs. Information is grouped by the use case and there are code samples available for download, as well as videos that showcase the final product.

Create navigation patterns between worksheets in a planning view template.
Configure a planning view template.

Ribbon Extension

An extension to the SAP IBP ribbon can be created using an .xml file and Microsoft Office Excel macros. File supporting ribbon extension has to be placed in %LOCALAPPDATA%\SAP_IBP_Addin (similarly to the file that supports graphic capabilities in planning views).

The SAP IBP ribbon can be extended by using an .xml file and VBA coding.

Activate Developer Tab and Work with SAP IBP APIs

Task 1: Work with Demand Changes and Pre-Determined Reason Codes

You want to make planning more user-friendly for the user while ensuring that changes are labeled and commented on accordingly.

Steps

  1. Access the template Combination-based Planning, and apply your My Group Products# filter to the last tab.

    1. If you have templates or favorites from previous exercises open, close them.

    2. In the Template Admin section of the SAP IBP ribbon, select Templates and open Combination-based Planning.

    3. Choose Planning ViewFilterEdit and apply your "My Group Products ##" filter to the Consensus Planning tab.

    4. Choose OK.

  2. Make a change to the consensus demand value and save your changes using standard functionality in the SAP IBP ribbon, and using the relevant API.

    1. On the Consensus Planning tab, make a change to the consensus demand for your product in the 3rd period from now. To save your change, choose Save Data.

    2. Make a change to the consensus demand for your product in the 4th period from now. To save your change, choose Save.

      Result

      You can see a prefilled comment (name of the template and the worksheet is taken from the Name Manager, with which you worked in the first exercise) and a reason code.

Task 2: Display the Code Supporting Combination-Based Planning and Test That Automation in the Planning View

To become familiar with the code for combination-based planning, display the code provided in the template, then scroll through the list of combinations.

Steps

  1. Validate that you have the Developer tab available in your Microsoft Excel UI and open the macro in the Planning worksheet.

    1. In the Microsoft Excel user interface, proceed to the Developer tab.

      Note

      If you do not see the tab, right-click anywhere in the ribbon and choose Customize the Ribbon and add the Developer tab.
    2. In the Code section, choose Visual BasicVBA ProjectExcel Add-in in VBA SampleSheet 2Planning and bring the code to the right pane.

    3. Observe how the IBP Automation Object is declared, then scroll down and check the code for subroutines Refresh, Next, and Previous.

      Result

      The code displays and looks like the screenshot.Code of the VBA project on the Developer tab.
  2. In the planning view, refresh the list of combinations and scroll through the list.

    1. Make sure that the planning view on the Planning sheet is open.

    2. In the List worksheet, choose Planning ViewFilterEdit and apply your My Group Products# filter.

    3. Choose OK.

      This creates a list of combinations that the planner would want to review one by one.

    4. Transition to the Planning worksheet and choose Refresh Worklist using the VBA control button above the planning grid. Observe that only one combination is shown.

    5. In the Planning worksheet, choose Next Item using the VBA control button above the planning grid. Observe that the next combination with another location is now shown.

    6. Choose Planning ViewFilterEdit and check that the filter settings are reflecting the combination in the planning view.

Log in to track your progress & complete quizzes