cancel
Showing results for 
Search instead for 
Did you mean: 

Numeric Overflow [314] AMDP Procedure

05-06-2020 10:04 PM
2410 views 4 comments
0 Likes
SAP Managed Tags
Subscribe

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.

0 Likes

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Likes

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?

venkateswaran_k
Active Contributor
0 Likes

Hi

Please increase the length of your Field5 - because the product of FIELD2 * FIELD3 is begger to hold in Field5.

So increase it. DECIMAL(18,2)

Regards,

Venkat

venkateswaran_k
Active Contributor
0 Likes

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

MateuszAdamus
Active Contributor
0 Likes

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,
Mateusz