Hi
I have String Datatype for Date variable in Crystal Reports. What should be the query syntax for OINV table in a Stored Procedure in Sap B1 Hana Database.
Thanks
Hi
I have String Datatype for Date variable in Crystal Reports. What should be the query syntax for OINV table in a Stored Procedure in Sap B1 Hana Database.
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
Naimish MakwanaRank #324 · 7.7K reputationPosted Jan 6, 2025, 4:59 AM EST
If the user enters the date in the format
dd/MM/yyyy, you'll need to adjust theTO_DATEfunction to match this format. Here's how you can modify the stored procedure to handle thedd/MM/yyyyformat:CREATE PROCEDURE GetInvoicesByDate (IN dateString NVARCHAR(10)) LANGUAGE SQLSCRIPT AS BEGIN DECLARE dateValue DATE; dateValue := TO_DATE(dateString, 'DD/MM/YYYY'); SELECT * FROM OINV WHERE DocDate = dateValue; END;In this example,
TO_DATE(dateString, 'DD/MM/YYYY')converts the string to a date format that matches thedd/MM/yyyyinput.This should work correctly for a date like
01/04/2024.Naimish MakwanaRank #324 · 7.7K reputationPosted Jan 6, 2025, 4:22 AM EST
To handle a date variable stored as a string in Crystal Reports and query the OINV table in a stored procedure for SAP B1 HANA, you can convert the string to a date format within your query. Here's an example of how you can do this:
CREATE PROCEDURE GetInvoicesByDate (IN dateString NVARCHAR(10)) LANGUAGE SQLSCRIPT AS BEGIN DECLARE dateValue DATE; dateValue := TO_DATE(dateString, 'YYYY-MM-DD'); SELECT * FROM OINV WHERE DocDate = dateValue; END;In this example:
dateStringis the input parameter of typeNVARCHAR(10)which holds the date as a string.TO_DATE(dateString, 'YYYY-MM-DD')converts the string to a date format.OINVtable where theDocDatematches the converted date.Make sure to adjust the date format in
TO_DATEfunction according to the format of your date string.Thanks
Ramco RamcoRank #462 · 5.4K reputationPosted Jan 6, 2025, 4:58 AM EST
Hi Naimish
If user enters 01/04/2024 . Will it work. User has entered date in dd/MM/yyyy.
Thanks