Technology Blog Posts by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
PritiT
Explorer
1,715

As a starting point, we add a new generic attribute to the Version dimension as follows:

Select_Month

Version dimension looks like below:

PritiT_0-1726123351434.png

We use getResultSet function to capture the Select Month attribute value of version from Version dimension. It is important to remember that for getResultSet function to work, Select_Month attribute must be made visible in the table widget, by right clicking on Version, navigating to Show/Hide > Properties (Set visible properties) and checking the box against Select_Month property.

In OnInitialization event of the first Page in Optimized Design Experience, we write the following code to capture the Select_Month value

//Capture version used in widget layout in planning story

var value = Table_1.getDataSource().getDimensionFilters("Version")[0];

var selection = {

    "Version": value

};

//console.log(selection);

var resultSet = Table_1.getDataSource().getResultSet(selection, 0, 1);

 

//Update ‘Select Month’ Current Date Input Control (story filter)

Select_Month = resultSet[0]["Version"].properties["Version.Select_Month"];

 

var year=ConvertUtils.stringToInteger(Select_Month.substr(0,4));

var month=ConvertUtils.stringToInteger(Select_Month.substr(4,2));

 

var calenderCCD = CurrentDateTime.createCalendarDateTime({granularity: CalendarTimeGranularity.Month, year: year, month: month});

Application.setCurrentDateTime(calenderCCD);

Conclusion: We can use this code in addition to the steps described in blogs https://community.sap.com/t5/technology-blogs-by-members/dynamically-manage-version-updates-in-sac-s... or https://community.sap.com/t5/technology-blogs-by-members/automate-monthly-forecast-version-update-in... to dynamically update the custom ‘current date’ being used in restricted measures of SAC story. This can help automate the entire SAC planning and analytics solution that’s based on the single underlying model, by updating the ‘Current Date Input Control’ value in just one location, thereby, reducing the maintenance time.

Labels in this area