Hello,
Yesterday, I tried to explore how to implement a more complex example with help of AMDP. So the scenario below came into my mind.
My Scenario
I want to group the sales order items of the EPM demo by the company, calculate the total of the gross amount and the rates for total gross amount. The interest rates are defined in my own database table.
Therefore I have created a simple database table, which consists of the column validfrom, validto and rate.
Please note: This example is not intended to reflect a real business requirement - it is just to explore the capabilities of AMDP. So, maybe the applied formulas can be incorrect.
Implementation
At first, I have created a CDS view for calculating the total by joining the tables snwd_bpa, snwd_so_inv_head and snwd_so_inv_item. Then, in the AMDP class I have implemented the SQLScript. In a report the results will be shown.
Please have a look at the attached files.
My Thoughts / Doubts
I am not sure, if the solution approach of mine is an elegant one: In the AMDP method, I have to iterations over a cursor for the CDS view and another one for the customizing table to calculate the rates. Okay it is really fast, but I think there is a better solution possible. The two iterations with the cursor seems to me a little bit clumsy ... Moreover I assume it breaks the parallelisation.
Can you please help me out?
Thanks in advance.
Kind regards,
Stefan