Use setUserInput and submitData Planning APIs

As a story developer, you can use setUserInput and submitData APIs to enable end users to change the value of a cell in a table in view time.

There are the following prerequisites:
  • You've assigned a planning model to the table - either a SAP BPC model or an SAP Analytics Cloud planning model.

  • You've set the table to planing-enabled. Just check whether you've selected the table property Planning enabled.

The setUserInput and submitData APIs work together.

Work with Booked and Unbooked Cells

When you change a booked value, the leaf members that aggregate up to that value are adjusted proportionally to reflect your change. When you enter a new value in an unbooked cell, which displays a dash character (-) instead of a value, values are also booked to one or more leaf members for each dimension that aggregates up to the cell.

Use setUserInput API

This API updates the cell of a table with a specified value and returns true if the operation was successful and false if the operation failed.
The selection must be a selection from the table, and the value must be supplied according to the user formatting settings. It can be one of the following:
  • A string representing a number

    The string can have 17 characters at maximum.

    If you attempt to use anything else than a number for a value, an error message mentioning that the value is invalid is displayed. For example:
    • If you use an empty string like Table_1.getPlanning().setUserInput({<selection>}, "");.

    • If you try to reset the value of a cell like Table_1.getPlanning().setUserInput({<selection>}, "-");

    • If you use an empty space for planning like Table_1.getPlanning().setUserInput({<selection>}, " ");

  • A scalar of the form *[multiplying factor]

    The scalar can have seven characters at maximum.

Use submitData() API

This API submits the updated cell data with all the modified data and initiates the refresh of data. It returns true if the operation was successful and false if the operation failed.

The submitData API should be called after all the desired cells have been planned. Just call submitData() once to observe the results on the planned table.

Example

The example is based on a table called Table_1 that has an underlying planning model.

Method

Sample Code

Planning a cell with the selection object

Even if the table is hidden, it's still possible to plan a cell.

Planning a cell with the selection from the table

Planning a cell with the value from an input field

In this example, there's an input field widget called InputField_1.

Useful Details

When you work with the APIs, note the following information:

  • If you add a new dimension using an API, you must first expand the dimension to be able to plan the cell.

  • If you plan a cell with the same value, the API returns true and overwrites the existing value.

  • If you plan setUserInput() with an invalid value, an error message is displayed and the API returns false.

  • If there's more than one table with the same underlying model, all the tables are updated once you plan a cell.