Skip to Content
0
Jul 31, 2023 at 08:40 AM

How to parse Excel Cell value as input for a Stored Protocol in SAP HANA

97 Views

Hi Experts,

I've just begun learning how to work with SAP Hana. I've stored a Procedure in a demo database, and am currently trying to call it via ODBC in an Excel File.

The Stored Procedure is:

image.png


Inside VBA, when I hard code the values for FromDate and ToDate in the source of the query formula as shown below, the data is pulled with no problem.
.... Source = Odbc.Query(""dsn=HDB"", ""CALL """"DEMO1"""".""""OPOR_Excel_Report""""('2022-11-01','2022-12-31');"")" & Chr(13) .... and so on

image.png


The Issue:
However, I am trying to use values from cells in the Excel Sheet for the inputs FromDate and ToDate. I tried using the following source in the VBA query:
... Source = Odbc.Query(""dsn=HDB"", ""CALL """"DEMO1"""".""""OPOR_Excel_Report""""('" & Range("B1").Value & "', '" & Range("B2").Value & "')"")" & Chr(13) ... and so on

with the main difference here being I tried using the values from the cells B1 and B2, which are formatted as 'text'.

image.png

When I try to do so, I get the following error:

image.png

I did try to change the format of the cells in excel to Date, and such, but got basically the same 339 invalid number error.

Is there a common way to parse excel cell values as inputs for Stored Procedures? I would greatly appreciate any help resolving this issue.

Attachments

image.png (11.0 kB)
image.png (12.9 kB)
image.png (10.9 kB)
image.png (9.8 kB)
image.png (19.4 kB)