on 2018 Dec 13 5:56 PM
Hello everyone,
I have a requirement where I need to create, over rolling daily period, a cumulative Key Figure.
For example:
2018.12.01 2018.12.02 2018.12.03
KF1 100 100 100
AGGKF1 100 200 300
I already tried SAP Note 2288329, but without success. And I found a little bit difficult to keep the master data once I need to do it for all my planning horizon, in daily buckets.
Any thoughts? 🙂
Kind regards,
Lorena Fumian
Request clarification before answering.
Hi Lorena
As of now their are only 2 (feasible) options thru which you can achieve the cumulative calculations. I recently finished a project where their was multiple cumulative calculation.
1) Use local member KF and put excel formulas or EPM functions to do the cumulative calculation.
2) Using Lcode for the cumulative calculations.
For option 1 the advantage is that you can create it using local KF and you control all aspect of the formula. So any changes in the future you can do it directly. Disadvantage is if you are loading a huge no of planning combination, then it will cause performance issues, as the formula will get executed n times where n= the no of combinations.
For option 2 the advantage is that you wont have any performance related issues. But you need to go to SAP for writing the code and it might take some time. Although cumulative calculation is a simple Lcode and I am sure SAP has that ready and they can deliver within a short time-frame. Below is a sample Lcode for cumulative calculation, just for reference
MDPCUMBUILDPLANFINAL - OUTPUT typedef Table<Int32\"PERIODID5\", Int32\"PRDNUM\", Int32\"LOCNUM\", NullFixed8<6> \"MDPBUILDPLANFINAL\"> SAPSOP_TT_IN_01; typedef Table<Int32\"PERIODID5\", Int32\"PRDNUM\", Int32\"LOCNUM\", NullFixed8<6> \"MDPBUILDPLANFINAL\", NullFixed8<6> \"MDPCUMBUILDPLANFINAL\"> SAPSOP_TT_OUT_01; export Void main( SAPSOP_TT_IN_01 \"SAPSOP_01234567890123456789012345678_INPUT_NODE_01\" oss_in, SAPSOP_TT_OUT_01 \"SAPSOP_01234567890123456789012345678_OUTPUT_NODE_01\" & oss_out ) { oss_out.replaceColumn( oss_in.getColumn<Int32>(\"PERIODID5\") ); oss_out.replaceColumn( oss_in.getColumn<Int32>(\"PRDNUM\") ); oss_out.replaceColumn( oss_in.getColumn<Int32>(\"LOCNUM\") ); oss_out.replaceColumn( oss_in.getColumn<NullFixed8<6>>(\"MDPBUILDPLANFINAL\") ); Column<Int32> col_PERIODID_out = oss_out.getColumn<Int32>(\"PERIODID5\"); Column<Int32> col_PRDNUM_out = oss_out.getColumn<Int32>(\"PRDNUM\"); Column<Int32> col_LOCNUM_out = oss_out.getColumn<Int32>(\"LOCNUM\"); Column<NullFixed8<6>> col_MDPCUMBUILDPLANFINAL = oss_out.getColumn<NullFixed8<6>>(\"MDPCUMBUILDPLANFINAL\"); Column<NullFixed8<6>> col_MDPBUILDPLANFINAL = oss_in.getColumn<NullFixed8<6>>(\"MDPBUILDPLANFINAL\"); //Initialize Local Variables NullFixed8<6> lv_MDPBUILDPLANFINAL; NullFixed8<6> lv_LCODE1IPKEYFIGURE2; NullFixed8<6> lv_zero = NullFixed8<6>(\"0\"); NullFixed8<6> lv_one = NullFixed8<6>(\"1\"); Size totalEntries = col_PERIODID_out.getSize(); col_MDPCUMBUILDPLANFINAL.setSize(totalEntries); Size mrow = 0z; //Main Logic Loop through all entries while ( mrow < totalEntries ) { if(col_MDPBUILDPLANFINAL[mrow].isNull()) { lv_MDPBUILDPLANFINAL = lv_zero; } else { lv_MDPBUILDPLANFINAL = col_MDPBUILDPLANFINAL[mrow]; } // If not first iteration if ( ( mrow > 0z ) && ( col_PRDNUM_out[mrow] == col_PRDNUM_out[mrow-1z] ) && ( col_LOCNUM_out[mrow] == col_LOCNUM_out[mrow-1z] ) ) { col_MDPCUMBUILDPLANFINAL[mrow] = lv_MDPBUILDPLANFINAL + col_MDPCUMBUILDPLANFINAL[mrow-1z]; } // First Period calculation else { col_MDPCUMBUILDPLANFINAL[mrow] = lv_MDPBUILDPLANFINAL; } mrow = mrow.next(); //end of WHILE } }
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Lorena,
You may try the option using local member discussed in previous threads-
https://answers.sap.com/questions/134015/calculating-cumulative-with-local-members-in-ibp.html
However i am not sure what problem you faced using note 2288329
Thanks,
Rohit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Rohit
Thanks for your answer! The problem I'm facing with note 2288329 is my KF is accumulating in reverse
2018.12.01 2018.12.02 2018.12.03
KF1 100 100 100
AGGKF1 300 200 100
And, once I have daily bucket. How can I keep my master data and reproduce this solution for all my planning horizon?
Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 9 | |
| 6 | |
| 3 | |
| 2 | |
| 1 | |
| 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.