Passing Input Parameter(s) from One Calculation View to Another
In HANA it is common to consume one view in another view while creating data models and most often to provide flexibility and restrict data we use input parameters in underlying view. In such cases, we need to pass these input parameters from wrapper view to inner views. We can split this requirement into two scenarios:
You have one graphical calculation view (GC_View_1) which has a mandatory input parameter (IP_1) and you are consuming this view in another graphical calculation view (GC_View_2). In this case, you need to pass IP_1 from this GC_View_2 because it is a mandatory input parameter of GC_View_1. In such scenario, you need to create an input parameter(IP_2) in your GC_View_2 and need to map IP_1 with IP_2.
A solution for this scenario is very well covered under below link:
You have one graphical calculation view (GC_View_1) which has a mandatory input parameter (IP_1), now you are consuming this view in a script calculation view (SC_View_2). In this case, you need to map input parameter of SC_View_2 to GC_View_1.
Although as per latest guidelines from SAP we should avoid using Script Calculation view however if you still have a use case where you need to use a script view then here is the solution for such use cases.
Just for the sake of simplicity and ease of understanding, I am covering this scenario with a very simple example.
I have created a graphical calculation view GC_View_Sal in which IP_Country is the mandatory input parameter:
Now I have created a wrapper view which is a script calculation view and in this view, I will call my graphical view:
Initially, I copied the select query from Job Log of my graphical calculation view and paste it into my script view:
As you can see in above screenshot $$IP_COUNTRY$$ has hard coded value US because this is what I passed while previewing data of my graphical view. In the real use case, this selection has to be dynamic and to make this selection dynamic I have created an input parameter IP_COUNTRY_SC in my script view.
And finally, now we need to map this IP_COUNTRY_SC with IP_COUNTRY of our graphical calculation view. So here is the mapping syntax:
Note: If you make any changes in above syntax like put PLACEHOLDER under quotes or used single quotes for $$IP_COUNTRY$$ instead of double quotes then you will receive syntax error.
Pasting syntax below so that you can copy and use it in your view:
One input parameter:
(PLACEHOLDER.”$$IP_COUNTRY$$” => :IP_COUNTRY_SC)
Multiple input parameters:
(PLACEHOLDER.”$$IP_1″ => :IP_1_SC,
PLACEHOLDER.”$$IP_2$$” => :IP_2_SC)