In SAP BI we have special option named as APD ( Analysis Process Designer), we can do many simple or complex calculations by this toll on data targets.
For our custom requirement we can also use ABAP in APD desing. We have the option of building abap code by below method.
In Routine we have various options as below
1 General : Naming place for object
2 Source fileds: We can select what are the fileds from the source are needed for calculations
In the above filed i have grouped the data by Contract number and i have not taken Contract account for futher calculation
3. Target fields:
Here by defaul we are getting the source fileds , plus we can add special field also. If we have want to add any values based on calculations. That can be filled in abap code.
4 Routine : In this last option we can write abap code , to change or delete or add the data as per our functional logic.
Here we have it_source as source table and et_target as target structure after our logic. Here i am deleting the duplicate data and taking latest record.
We can do any calcualtions by using abap code in APD on existing data as per functional logic and can get results for these.