HANA sql condition conversion Answered

lorenzo pelati

Hi expert

i want to use sql condition on sap hana. i want to add an UF that it block add journal entry if Actype on OACT is equal to 'E'

 

DECLARE Tipo_conto as varchar(20)

SELECT T0."ActType" into Tipo_conto
FROM OACT T0 WHERE T0."AcctCode" = $[$76.1.0]

SELECT CASE
WHEN :Tipo_conto = 'E'
THEN
(SELECT 'Blocco_per_conto_tipo_economico' from DUMMY )
END

which is my error in sql condition?

thank you

 

Comments

1 comment

  • Comment author
    Yaremi Miranda Lopez
    • Official comment

    Hello Lorenzo,

    I'm no HANA expert but I seem to me that the problem is the variable. I created a query in my system and here is the result in SQL and after converting it using the SQL HANA conversion tool by Boyum IT. It should work.

     

     

     

     

    SELECT CASE
    WHEN ((SELECT T0."ActType" FROM "OACT" T0 WHERE T0."AcctCode" = $[$76.1.0]) = 'E')
    THEN
    (
    SELECT 'BOYUM' FROM DUMMY
    )
    END FROM Dummy

Please sign in to leave a comment.