on 03-29-2012 4:08 AM
Dear SAP,
I have a problem in using macro to calculate key at detail locaotion level like this:
For example: I use macro to calculate key "So luong can dieu hoa"
So luong can dieu hoa(Location:1000) = Ton kho theo co cau(Location: 1000+2000) * Ty le co cau kho tien(Location: 1000)/100
with Ton kho theo co cau( total) = Ton kho theo co cau(Location:1000) + Ton kho theo co cau(Location:2000)
Problem here is we want calculate So luong can dieu hoa at detail level of location but Ton kho theo co cau at total level.
so how can we design macro?
thanks
Please help me. it's very important.
thanks
hungth
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Hungth,
Here is one alternative to achieve your requirement assuming you are allowed to define the procedure.
1. User will load the entire selection profile data on to data view, so that you can see all the key figures showing their total values.
2. In your macro book, capture the required key figure value at this level based on the following pseudo code. This macro should be added to the start event.
STEP - 1 Iteration
IF( AGG_LEVEL = 1 )
VEC_LAYOUTVARIABLE_SET( 'KF_TOTAL' ;
AREA Macro element of 'Ton kho theo co cau' for the entire horizon
)
3. Your user now drills down to required level and triggers another macro (this action may be manual or if you want automatic action add the macro to 'Level Change' event)
STEP1 - Entire horizon
Action box macro element - Set a variable
LAYOUTVARIABLE_SET( 'TOTAL' ;
VEC_LAYOUTVARIABLE( 'KF_TOTAL' ; ACT_COLUMN ; ACT_COLUMN ) )
luong can dieu hoa(Location:1000) = LAYOUTVAL_VALUE( 'TOTAL' ) * Ty le co cau kho tien(Location: 1000)/100
I hope it is useful to you.
Thanks,
Rajesh
Hi Hung,
Please check the following screenshots of macro implementation and let me know if you have any query.
Thanks,
Rajesh
Scenario Objective: Calculate Proportional Factors
Description: It is required to calculate the proportional factors based on the proportions of forecasts generated for a couple of locations (Loc 1 and Loc 2).
Proportional Factor (Loc 1 ) = ( Forecast (Loc 1) / Total Forecast ) * 100
Where Total Forecast = Forecast (Loc 1) + Forecast (Loc 2)
Macros:
I used a composite macro to capture the aggregate value and one more macro to update the key figure. Composite and normal macros are to be executed manually. They are not added to any events.
Hi,
Commenting only for your usage of AGG_LEVEL.
You need to tell the system what aggregation you are talking about, so you need to give some characteristic also as an argument when you use this function.
e.g. You could check if AGG_LEVEL('9AMATNR') = 1
Replace 9AMATNR by the relevant characteristic for which you want to check the aggregation.
Thanks - Pawan
User | Count |
---|---|
9 | |
4 | |
3 | |
2 | |
2 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.