Skip to Content

xP&A CX Commercial Planning - Understanding the technical structure of Stories

This tutorial will explain to you the technical structure of each story so you can easily customize your content.
You will learn
  • how stories are built from a technical perspective. This includes…
  • …understanding the structure of stories
  • …understanding the naming convention of the objects and widgets
  • …learning about the usage of script variables
  • …learning about the script objects
RudolfLindt93Rudolf LindtAugust 7, 2024
Created by
HeGro
November 9, 2023
Contributors
HeGro

Prerequisites

Now that you have successfully gone through the introduction tutorials and know how to use the content package like an expert, you may want to start customizing it and adjusting it according to your own business needs.

Before you do that though, it is highly recommended to go through this tutorial in order to understand how the stories are structured and how the objects are used in the standard content.

In case you have any questions or require further support, please use the SAP Question Form.

If you have a specific request to our team in regards to the business content, you may also submit a request using the SAP Influence Platform.

If you are interested in more xP&A topics, related business content packages, or videos showing the content in action, feel free to check out our community page Extended Planning & Analysis Business Content.

  • Step 1

    In this step you will learn about the structure of UI elements in each story.

  • Step 2

    In this step you will learn about the naming convention of UI elements and script objects in each story.

    You may have noticed that most of the objects have some sort of abbreviations as prefix.

    The abbreviations indicate what kind of technical object is used for the specific widget. Afterwards follows a descriptive naming. The following list will help you to understand the meaning of the abbreviations:

    Abbreviation Widget
    dd drop down
    cb check box group
    dialog pop up
    tbl table
    ic input control
    shp shape
    btn button
    pnl panel
    fpnl flow layout panel
    txt text
    rb radio button
    da data action
    ma multi action
    swi switch
    img image
  • Step 3

    In this step you will learn about script variables and how they are named.

    Generally the Script Variables section is the place where you can define global variables for your story.

    xp&A Commercial Planning

    In the scope of this content, two different groups of variables have been created.

    • All variables with the prefix cfg_ are considered to be constant variables which are never changed.
    • In native JavaScript language, these variables would be declared as const. As the in-built SAC IDE does not offer this, we decided to mark constant variables with the cfg_ prefix.
    • All variables with the prefix g_ are considered to be ordinary global variables which can be changed or overwritten during runtime.

    • In native JavaScript language, these variables would be declared as let. As the in-built SAC IDE does not offer this, we decided to mark these variables with the g_ prefix.
    • Some of the variables are initialized directly in the menu provided by the builder panel.

      xp&A Commercial Planning
    • Other variables are initialized in the onInitialization script of the story. The following screenshot provides such an example.

      xp&A Commercial Planning

    Many variables are re-used across all stories while some of the variables only exist inside a particular story. The following list provides an overview of the most important and common variables and how they are used:

    • The variable cfg_chartCollection is an array of chart objects which can be found in many stories and is initialized in the onInitialization script. It is used to store all chart objects of a particular story.
    • The variable is mainly used in order to loop over all chart objects, making it easy to address all chart widgets of a story at once.

      xp&A Commercial Planning
    • The variable cfg_tableCollection is an array of table objects which can be found in many stories and is initialized in the onInitialization script. It is used to store all table objects of a particular story.

    • The variable is mainly used in order to loop over all table objects, making it easy to address all table widgets of a story at once.

      xp&A Commercial Planning
    • The variable cfg_dimensionMapping of type Selection is initialized in the onInitialization script and serves as a dictionary which stores all dimension IDs of the data model and provides a descriptive naming to these dimensions.

      xp&A Commercial Planning
    • The left column, also known as the key, provides the descriptive naming for the dimension ID, whereas the right column, also known as the value represents the technical dimension ID as it is stored in the data model.

    • This variable is used in order to ease the usage of dimension IDs in the scripts. By using this dictionary, you can work with the easy descriptions instead of having to write the entire dimension ID each time you call a script or API where you need to specify a dimension.
    • If for instance your product dimension has a different dimension ID, you can simply replace the value in the dictionary with your own ID and the scripts will still work without having to change the dimension in every single line of code where the product dimension is used.

      xp&A Commercial Planning
    • The variable cfg_displayMode of type string is initialized in the onInitialization script.

    • It is hard coded to one single value present and is used when switching over to other stories when using the navigation menu. The script used to open a new story consumes this variable and opens the story in present mode respectively. If you want to open the story in another mode than the present mode, you may change the value to any other valid value than present.

      xp&A Commercial Planning
    • The variable cfg_iconRepository of type Selection is initialized in the onInitialization script and serves as a dictionary to store the unicode of an icon together with its descriptive name in a key-value fashion similar to cfg_dimensionMapping.

    • Also here, the main use case is to ease the usage and addressing of icons in the scripts.

      xp&A Commercial Planning
    • The variable cfg_measureMapping of type Selection is initialized in the onInitialization script and serves as a dictionary which stores all measure IDs of the data model and the story and provides a descriptive naming to these measures.

      xp&A Commercial Planning
    • Similar to the variable cfg_dimensionMapping, this dictionary is mainly used to ease the usage of measure IDs in the scripts. In addition to that it also provides more flexibility, as you can change the measure IDs in your data model freely and only need to update the new ID on one single spot instead of having to go into every single script where the measure is called.

      xp&A Commercial Planning
    • The variable cfg_planVersion of type string is initialized in both the onInitialization script and the Right-side panel where it is provided a default value.

    • It is hard coded to the default plan version of this content package, which is the public.Plan version.

      xp&A Commercial Planning
    • The variable g_versionText of type string is used for the same purpose, except that it does not store the prefix but only the version text itself. Similar to cfg_planVersion, it is hard coded to the value Plan.

      xp&A Commercial Planning
    • The variable cfg_storyIds of type Selection is initialized in the onInitialization script and serves as a dictionary which stores all story IDs of the content package and provides a descriptive naming to these stories.

    • This dictionary is used for the navigation menu. By having initialized this dictionary in a central place, you can create new stories or copy existing stories and maintain everything in one single spot instead of having to look for the button or widget where the script to open another story is called.

      xp&A Commercial Planning
    • The variable g_actionConfirmReset of type string is not initialized on startup and does not posses a default value. It is used in the process of publishing or reverting a version and stores information on whether the version will be published or reverted.

    • Depending on the story, there may also be additional variables which have not been mentioned here. Covering every single variable which was created to serve for one particular purpose would go beyond the scope of this tutorial. Please check the in-line documentation to find out what they are used for and where they are used by using the in-built search function in SAC.

      xp&A Commercial Planning
  • Step 4

    In this step you will learn about script objects and how they are clustered.

    Generally the Script Objects section is the place where you can create scripts which then can be called by different events, such as onClick or onChange events for instance.

    In the scope of this content, you will find three different groups of scripts, which are clustered in applicationScripts, layoutScripts and utilityScripts.

    xp&A Commercial Planning
    • The applicationScripts group is the place where all story specific scripts are stored. These kind of scripts are not re-usable as they execute a very specific task designed for one particular story only.
    • The layoutScripts group is the place where all layout related scripts are stored. These kind of scripts are used to change the layout of the application and come into action when you collapse a table for example or expand a section.
    • The utilityScripts group is the place where generic scripts are stored. These kind of scripts are reusable and provide basic functions which can be executed independent of the story you are working on, such as converting a date to a string or similar things.
  • Step 5

    Congratulations! You have finished the tutorial and are now able to navigate through the story from a technical perspective.

    If you want to learn more about the modules of this content package, check out the following tutorials:

    If you want to customize the content and adjust it according to your own business requirements, the following resources might be helpful:

    If you want to get an overview of the entire xP&A Commercial Planning content package, make sure to check out the Mission.

    Interested in more xP&A topics and related business content packages? Visit our community page Extended Planning & Analysis Business Content.

Back to top