Technology Blogs 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: 
vignesh3027
Explorer
0 Kudos
5,087
Aim: To create a calculation view with multiple input parameter that should display data corresponding to the input parameter.

The entire calculation view is here,



Step 1

  • It is necessary to create a Input parameter in a calculation view to get input from the user.

  • In our case, I created input parameters for Company code, Date and Profit centre.


Step 2




  • In our case I m going to get multiple inputs for Company code and Profit centre.

  • Make sure that you have enabled the Multiple Entries option while creating and defining the Input parameter.

  • You can also provide default values here itself.




Step 3

  • To achieve multiple input parameter, it is necessary to filter the input parameters in the filter expression.



 

Step 4

Syntax:

(in("field name in table", $$ Input parameter $$) or match("field name in table", $$ Input parameter $$)) and (in("field name in table", $$ Input parameter $$) or match("field name in table", $$ Input parameter $$))

Expression formula in our case:

(in("BUKRS", $$Company_code$$) or match("BUKRS", $$Company_code$$)) and (in("PRCTR", $$Profit_centre$$) or match("PRCTR",$$Profit_centre$$))


Explanation:

  • It is possible by using in() or match ()

  • In (): It is used to filter the data by condition of the input data is IN the table => display those data.

  • Or: It allows to check two conditions.

  • Match (): it is used to filter the data by condition of the input data is MATCH any entires in the table => display those data.


(in("BUKRS", $$Company_code$$) or match("BUKRS", $$Company_code$$)) and (in("PRCTR", $$Profit_centre$$) or match("PRCTR",$$Profit_centre$$))

  • $$Company_code$$ - Input parameter that we created.

  • "BUKRS" - company code field name in the table.

  • $$Profit_centre$$ - Input parameter that we created.

  • "PRCTR" – profit centre field name in the table.


Step 5

Executing for

Date: 201812

Company Code: 3000

Company Code: AJSC

Profit Centre: 0000001000

Profit Centre: 0000002000

Profit Centre: 0000003000


 

Output

Data filtered successfully for the corresponding input parameter.


Thank You !
6 Comments
romittal
Member
0 Kudos

Hi Vignesh,

Thank you for every details you highlighted in the blog.

Just need to understand what would be the output when let say you run the query without inputting any values to $$Company_code$$ and $$Profit_centre$$ input parameter values?

(in(“BUKRS”, $$Company_code$$) or match(“BUKRS”, $$Company_code$$)) and (in(“PRCTR”, $$Profit_centre$$) or match(“PRCTR”,$$Profit_centre$$))

Regards,

Rohan

vignesh3027
Explorer
0 Kudos

Hi Rohan Mittal,

In that case it will display the output corresponding to the applied date, It will display all the Company codes and Profit centres with the corresponding applied date.

INPUT:

OUTPUT:

Thank you!

leandrong
Explorer
0 Kudos
Hi Vignesh,

Thanks for this blog.

I have a problem with an input parameter with multiple values.

I use this expression:

in("LGORT",$$IP_LGORT$$)

It works only If enter at least one value, if I leave the parameter empty I get the following error:

Error: SAP DBTech JDBC: [2048]: column store error: search table error: [34023] Instantiation of calculation model failed;exception 306108: Query entries cannot be parsed. Failed to convert expression "in("LGORT",)" to QueryEntries at node Projection_2. Reason: Evaluator: syntax error in expression string;expected TK_ID,'in("LGORT",[here])'

I tried using "if" and "isnull" but I get same error because function IN is expecting something.

Do you have any clue to solve this issue?

Thanks in advance!
0 Kudos

Thanks for the blog, It was my interview question.

DirkO
Participant

@leandrong 

Hi,

not sure that I can answer your question.

But in case the underlying field is from type VARCHAR, you can add a default value * like I did here for p_gender and p_name .

DirkO_0-1711214709983.png

DirkO_1-1711214843843.png

As a result of this, you do not have to provide a value for both parameters.

Selection:

DirkO_2-1711214892107.png

Result:

DirkO_3-1711214902202.png

Hope this answers your question.

 

roslyn_rosalia3
Explorer
0 Kudos

Hello,

 

How the does the multiple entry input parameter work if it's a sql view? What is the correct syntax?

column in(:input_parameter) does not work because of multiple quotations if it multiple entry.

the syntax in sql is  column in('value1','value2')

while if you replace that with the input_parameter - multiple entries enabled, it's like below.

column in('''value1'',''value2''') which does not work.

 

 

Labels in this area