Hi
How to execute Stored Procedure with Date Paramters & a string Parameter in Sap b1 Hana
Thanks
Hi
How to execute Stored Procedure with Date Paramters & a string Parameter in Sap b1 Hana
Thanks
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Manikandan MurugesanRank #300 · 8.4K reputationPosted Jan 28, 2025, 12:00 AM EST
To execute a stored procedure in SAP B1 HANA with date and string parameters, you can use SQL commands through the SAP HANA database client (HANA Studio, HANA Cockpit, or SQL Console) or via SAP B1 SDK tools like the DI API or Service Layer.
Using SQL Console
Here’s the general syntax for executing a stored procedure with parameters:
CALL ""."" (, , ...);Example Stored Procedure Execution:
Assume you have a stored procedure named
usp_GetOrderswith the following parameters:@StartDate(DATE)@EndDate(DATE)@CustomerCode(NVARCHAR or STRING)Here’s how you would call the stored procedure:
CALL "schema_name"."usp_GetOrders" ('2025-01-01', '2025-01-28', 'CUST001');Key Notes:
"schema_name"with the actual schema where the stored procedure resides (default is usuallydbofor B1 systems).YYYY-MM-DD.').Muhammad Imran AnsariRank #326 · 7.6K reputationPosted Jan 28, 2025, 11:19 AM EST
Hi Ramco,
You can use the CALL statement in HANA SQL. Below is the syntax and an example to help you:
Syntex:
CALL "." (, , ...);Example with Date and String Parameters:
Let’s assume your stored procedure looks like this:
CREATE PROCEDURE "MySchema"."MyProcedure" ( IN "StartDate" DATE, IN "EndDate" DATE, IN "SearchTerm" NVARCHAR(100) ) LANGUAGE SQLSCRIPT AS BEGIN -- Your logic here SELECT * FROM "MyTable" WHERE "CreatedDate" BETWEEN :StartDate AND :EndDate AND "Description" LIKE '%' || :SearchTerm || '%'; END;Execution/Call:
CALL "MySchema"."MyProcedure" ('2025-01-01', '2025-01-28', 'TestString');