cancel
Showing results for 
Search instead for 
Did you mean: 

Formatted search to calculate discount on Sap B1 HANA

0 Kudos

HI EXPERTS

I'm trying to create a formatted search on Sap B1 HANA about discount managing on purchase documents. I want to manage 2 discount percentage in document rows. I have created 2 UDF (Discount1, Discount2 - field structure >> Percentage).
These 2 discounts are applied sequentially on each row of the document. The result will fill automatically the standard field DiscPrcnt by a formatted search, when the UDF Discount2 is filled up.
For example in each row we have 20% + 5%. The result will be 24%. This value fills automatically DiscPrcnt.

I need to create a formatted search that reads directly the form opened (not from the table in the database). So I use the variables.
I have done it on SQL SERVER and it works perfectly. Here you are the SQL code:

SELECT (1-((1-($[$38.U_Discount1.number]/100)) * (1-($[$38.U_Discount2.number]/100)))) *100

On Sap B1 HANA it doesn't work.

Any suggestion?

Thanks a lot

Regards

Stefano Pari

Accepted Solutions (0)

Answers (3)

Answers (3)

0 Kudos

Hi all

thanks a lot

Best Regards

Stefano

kothandaraman_nagarajan
Active Contributor
0 Kudos

Hi,

Check this blog how to convert SQL to HANA,

https://blogs.sap.com/2013/10/30/syntax-of-formatted-search-in-sap-business-one-version-for-sap/

Try this,

SELECT (1-((1-($[$38."U_Discount1".number]/100)) * (1-($[$38."U_Discount2".number]/100)))) *100 FROM DUMMY

Regards,

Nagarajan

Abdul
Active Contributor
0 Kudos

add fields names in "" like

SELECT (1-((1-($[$38."U_Discount1".number]/100)) * (1-($[$38."U_Discount2".number]/100)))) *100

In HANA we need to add quotes for each field in query.