Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member

Hello everyone,

So as a continuation of the previous blog post I would like to take it further and go a bit more into the details for performing various operation on the input enabled queries. Such as Recalculate, Save and Reset to Client/server.

If you havent had a chance to go through my first blog yet, you may do so here : #1 Planning in Design Studio 1.3

  1. You have the following methods available via script editor which you can use in your planning application :

2.  Let’s create one button for each function and see how we can use each of them

Each button has the following script assigned to it respectively :

     a. Recalculate :

     Planning.recalculate();

   b. Save :

     Planning.save();

   c. Server Reset :

     Planning.reset();

   d. Client Reset :

     Planning.clientReset();

   e. Check unsaved changes :

if ((Planning.hasUnsavedChanges() == true)) {

   APPLICATION.alert("Application has unsaved changes");

} else {

   APPLICATION.alert("Application does not have any unsaved changes") ;

}

     f. Check not recalculated client Changes :

if ((Planning.hasClientChanges() == true)) {

   APPLICATION.alert("Application has client(not recalculated) changes");

} else {

   APPLICATION.alert("Application does not have any client(not recalculated) changes") ;

}


3. Now let’s look into the working of each method :

a. Initial view of the application :

 

b.     Let’s change the Current salary value for Employee ID = E06 to 1000 EUR and then click on recalculate button

    

         Result : you can see that the value gets changed and is updated in the Result for Employee ID E06 as well.


c.     Click on save and the new data gets saved in the backend. Every time you refresh the application now, always the newly saved data will be reflected for the data source in the application.

d.     There are two reset methods, one is the server reset and the other is the client reset.

Server Reset :

This is to take you to the last unsaved state of the data for your input enabled query.

Client Reset:

This is mainly to go back to your last recalculated state.

You can check this by changing some value in any of the input fields, say change the value of salary of employee E11 to 2000 Euro and click on recalculate.

Now click on server reset and you will see the value will be set back to the last unsaved state i.e. 1 EUR

Similarly in order to check Client reset again change the value of salary of employee E11 to 2000 Euro and recalculate and then change it to 3000 but do not recalculate this time.

Now click on Client reset and you will see the value will be set back to the last client (not recalculated) state i.e. 2000 EUR

e.    hasUnsavedChanges and hasClientChanges:

These two methods are mainly to check whether there are any unsaved or client(not recalculated) changes currently in your application respectively.

hasUnsavedChanges :

To check this lets change the value of salary of employee E11 to 2000 Euro and click on recalculate.

Now click on the button “Check unsaved changes”.

Based on the scripting done earlier, You will get the alert message :

Now click on the button Server Reset and hit the button “Check unsaved changes” again.

Based on the scripting done earlier, You will get the alert message :

hasClientChanges :

Similarly now change the value of salary of employee E11 to 2000 Euro and do not recalculate.

Now click on the button “Check not recalculated client Changes”.

Based on the scripting done earlier, You will get the alert message :

                   

Now click on the button Client Reset and hit the button “Check not recalculated client Changes” again.

Based on the scripting done earlier, You will get the alert message :

                   

RELATED:

#1 Planning in Design Studio 1.3

8 Comments