Hi Experts,
HANA DB version 1.0
BW Version 7.4 SP16
Q1) Please clarify on the numeric overflow issue with the following case statement which is written in AMDP procedure in BW transformation.
FIELD3 NVARCHAR(4) - VALUE 003
FIELD2 DECIMAL(10,2) - 0
FIELD4 INTEGER - 0
CASE
WHEN FIELD1 = 2 THEN ( FIELD2 * FIELD3) / FIELD4
END AS FIELD5;
This code is giving 314 Numeric Overflow error and not Divide by 0. when i replace the code as below with values then also it is giving 314 error
CASE
WHEN FIELD1 = '2' THEN ( 0 * FIELD3) / 0
END AS FIELD5;
If I give the direct value of FIELD3 as 003 in calculation it is showing divide by zero.Something happening with FIELD3.
Please clarify why the code is behaving like this
Q2) In the above code how to explictly get the datatype of field5 ? We know that what ever the outcome of case statement that value will come into FIELD5, But please show a way to identify the datatype with help of script code or any other way.
Request clarification before answering.
Hi Venkat, mateuszadamus
Thanks for your reply.
a) The error should be Divide by Zero but why it is showing numeric overflow.
so trying to know why numeric overflow error message?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
a) It is explicit message that you are trying to divide by zero - which will throw dump/error. Hence you should change your case statement as below
CASE
WHEN ( FIELD1 = 2 AND FIELD4 > 0 ) THEN ( FIELD2 * FIELD3) / FIELD4 ELSE 0
END AS FIELD5;
b) Regarding the data type of Field5, It should be same as Field2 - since you are multiplying with some value on Field2 - hence output will be same as the Field2. In this case it should be DECIMAL(10,2). However if the Field3 is coming as big number, then you may have to increase the decimal length to example DECIMAL(12,2)
Regards,
Venkat
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi bwstudent
Q1. Please start by reading and understanding of the error messages. It will help you solve the issues by yourself. Clearly, you cannot divide by zero, which you are doing.
Q2. As to the output parameter, please have a look at the documentation: https://help.sap.com/doc/abapdocu_750_index_htm/7.50/en-US/abenamdp_hdb_sqlscript.htm
Regards,You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.