Skip to Content
0
Nov 14 at 08:32 PM

Calculating Percentage for OData Service

240 Views Last edit Nov 15 at 10:45 AM 6 rev

Hi,

I am trying to fill a structure that basically only has an ID and a percentage for an OData Service. All values come out of tables that are already part of the OData service, however the percentage is missing.

The OData Service is for a Fiori-application.

When I am tryng to calculate the percentage a error message is shown (roughly translated) it says:
"The operators DIV and MOD cannot be used in an expression that contains real decimal numbers such as X." with X being one of the two numbers I need for the calculation.

Because of our old system I can't use CDS Views.

The code is basically like this:

SELECT table1~id, DIV( table2~X, table2~Y) AS percentage
FROM table1 JOIN table2 
ON table1~id EQ table2~id<br>INTO CORRESPONDING FIELDS OF TABLE @ET_ENTITYSET.

That's why I wanted to ask if someone got an idea how to solve it and can give me a hint.

Thanks in advance!

Philipp