0

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.

koks der drache
  • 1,398
  • 1
  • 16
  • 33
  • Can you please edit your question with the actual sometable.somecolumn, and values you used, and indicate the definition of the corresponding table column and data element in the ABAP dictionary, so that your question is not too much abstract (remember how important are [Minimal Reproducible Examples](https://stackoverflow.com/help/minimal-reproducible-example) in Stack Overflow). – Sandra Rossi Oct 15 '19 at 13:41
  • @SandraRossi The table is from a IS module so adding the actual table and column imho doesn't add any benefit to the general audience. It's only relevant, that the data element is of type `DEC`. I'll add this info. – koks der drache Oct 15 '19 at 13:47
  • 1
    You're right and that's why people who ask questions have to spend time on creating a small reproducible example before posting (c.f. [Restart from scratch, Divide and conquer, and so on](https://stackoverflow.com/help/minimal-reproducible-example)). For instance, by creating a CDS view using the column PRICE (DEC 15,2) of the SFLIGHT table (the Flight Model is available on all ABAP-based systems). – Sandra Rossi Oct 15 '19 at 15:04

1 Answers1

0

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.

koks der drache
  • 1,398
  • 1
  • 16
  • 33
  • and how do you pass your `` and ``? As view input parameters? – Suncatcher Oct 28 '19 at 21:59
  • Actually I didn't use them as input parameters, because using any input parameters in SAP R/3 CDS is prone to massive performance break downs. This is mainly my personal trial and error experience and, of course, barely documented anywhere (except for [Oracle DB version <19.5](https://assets.cdn.sap.com/sapcom/docs/2018/02/de1db6cd-ee7c-0010-82c7-eda71af511fa.pdf)). So I ended up exporting the `DEC` number with hard coded `+` pre decimal places and 0 post decimal places plus an additional column specifying the actual decimal point position for some SAP external post processing :-/ – koks der drache Oct 29 '19 at 07:12