cancel
Showing results for 
Search instead for 
Did you mean: 

Can we call a CV with input parameters in HANA procedure

former_member191728
Active Participant
0 Kudos

HI Experts

1. I have created a Calculation View with two input parameters

2, Now I have created a procedure with two input parameters

3. Now I want to call the calcview in my procedure passing the input parameters created in my procedure

syntax

begin

it_out = select * from calcview ( 'PLACEHOLDER' = ( '$$input1$$ ', :ip_input1 ),

                                               'PLACEHOLDER' = ( '$$input2$$ ', :ip_input2 ) );

end;

Is my approch correct ?

Can we call view from procedure

Thanks

Pawan Akella

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Pawan,

Use this:

begin

it_out = select * from "_SYS_BIC"."<package_name>/<view_name>"

          ( PLACEHOLDER."$$input1$$" => :ip_input1, PLACEHOLDER."$$input2$$" => :ip_input2);

end;

Thanks,

Sumit

Answers (2)

Answers (2)

former_member210482
Active Participant
0 Kudos

Hi Pawan,

To summarize, first you need to declare these input parameters in your procedure IN, ie

CREATE PROCEDURE "schema"."procedure"( in input1 int, in input2 int,out it_out)

    LANGUAGE SQLSCRIPT AS

.

.

.

Then  use it in your calculation view as shown

it_out = select * from "_SYS_BIC"."<package_name>/<view_name>"('PLACEHOLDER' = ('$$input_param1$$', :input1 ), 'PLACEHOLDER' = ('$$input_param2$$', :input2));


Here $$input_param1$$ is the input parameter present in your cv. Hope you are clear..


Cheers,

Safiyu

Former Member
0 Kudos

Hello Pawan,

Yes, you can do that.

Thanks

Praneeth

former_member191728
Active Participant
0 Kudos

Hi Praneeth

Is my syntax is correct?

The way I am calling the CV from procedure is correct?

Thanks

Pawan Akella

former_member210482
Active Participant
0 Kudos

Hi Pavan,

No your syntax is wrong. You have to use Generated column views for the respective CV from sys_bic schema. Also you dont have to use placeholder. While creating a procedure you have a option of defining inputs either using IN keyword or from the window in your right side.

To use an input you can directly use : followed by your input name.

Regards,

Safiyu

former_member191728
Active Participant
0 Kudos

Hi Safiyudeen

I am using CV generated in _SYS_BIC schema and I also created input parameters using the option available on the right hand side

My question is

it_output -> this is my procedure output created on the right hand side

it_output = select * from "_sys_bic"."package_name/CV_NAME"

                         ('PLACEHOLDER', ( '$$cv_input$$' , :ip_proc_input);

Is my above synax is correct

Am I calling the CV correctly from Procedure using input parameters



Thanks

Pawan Akella

Former Member
0 Kudos

Hi Pawan,

In the above syntax you didn't close the Placeholder properly.

This should work if there is one input parameter.

But when there are more than one input parameter, better way is to do the way I have shown below.

Thanks,

Sumit

former_member210482
Active Participant
0 Kudos

Hi Pawan,

Yes correct. But one closing bracket is missing.

Cheers,

Safiyu