on 04-01-2016 3:08 AM
Hi
I have a formatted search as below for a UDF in outgoing payment screen
Select"CardFName" From OCRD Where "CardCode" = $[OVPM."CardCode"]
The problem is that if user do not select any card code in outgoing payment which means $[OVPM."CardCode"] is null, I would like to just select all foreign name from business partner master data and allow them to select manually from the list. I tried to do the query like below but encountered error "Incorrect syntax near IF". Please kindly advise
IF IFNULL($[OVPM."CardCode"],'') = ''
BEGIN
SELECT "CardFName" FROM OCRD
ELSE
SELECT "CardFName" FROM OCRD WHERE "CardCode" = $[OVPM."CardCode"]
END
Note: SAP B1 HANA
Regards
Yvaine
Hi Yvaine,
Please refer to this webpage:
SAP HANA SQL and System Views Reference - SAP Library
You will find that IF statements are not supported in SAP HANA.
You can use CASE/WHEN as alternative. Look under the topic 'Expressions' in the above web link.
Kind Regards,
Nick Lakasas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you so much. I am afraid we can only put case in select statement for eg:
Select CASE $[OVPM."CardCode"] WHEN '1' THEN 'Wrong' ELSE 'Correct' END AS Result
I am not able to put the case outside the query as the first condition to determine which query to execute for the UDF, for eg:
CASE $[OVPM."CardCode"] WHEN '1' THEN
SELECT * FROM OCRD
ELSE
SELECT * FROM OITM
Hi Kong,
try this,
IF ISNULL($[OVPM."CardCode"],'') = ''
BEGIN
SELECT "CardFName" FROM OCRD
ELSE
SELECT "CardFName" FROM OCRD WHERE "CardCode" = $[OVPM."CardCode"]
END
Thanks,
Harshal
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
107 | |
12 | |
11 | |
6 | |
6 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.