Search code examples
opensqlcds

Error after cast in ABAP CDS "POS(1) invalid exponent"


After I added a cast( sometable.somecolumn as abap.dec( <x> , <y> ) ) to my Core Data Service (CDS) data definition (DDL) on SAP R/3 ABAP 7.50 with <x> and <y> as placeholders for the numbers of pre- and post-decimal positions, I am not able to read the data from the CDS. There is an error message that says:

database returned sql code 3.0.19- error text POS(1) invalid exponent

somecolumn already has type DEC.

The activation returned no errors or warnings.


Solution

  • As often within SAP/ABAP the error message does not describe the actual error.

    Check the size of sometable.somecolumn using transaction se11 and modify <x> and <y> such that <x> + <y> equals the total number of positions of the datatype of sometable.somecolumn.