Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

ABAP CDS View : Need help with calculation

sachin_soni
Active Participant
0 Kudos

Hi Everyone,

I have designed CDS view for a Sales Report.

The output has fields like Company Code,Fiscal Year,Period,Target Quantity,Actual Quantity

I am getting the quantity from a custom table which is month/period wise.

The requirement is to calculate the Pro-rata Quantity as on current date.

For example.:For January - Quantity = 100 so as on 11/01 the Quantity would be = (100/<last day of the month>) * current date.

I got the date using the $session variable with sub-string function but that is not getting casted to a number type.

Also , could not find a function to get the last day of the month.

I think this should be possible, Please share your insights !

Thanks,

Sachin

2 REPLIES 2

nabheetscn
Active Contributor
0 Kudos

The Date can be casted to String first -> String to NUMC-> Integer. Check the table for casting at SAP help..

0 Kudos

Alternatively ,We can pass the last day of Month field explicitly using parameterized CDS views.