on 02-09-2016 3:15 PM
Hi experts,
I've ready Vadim's post here : http://scn.sap.com/community/epm/planning-and-consolidation-for-netweaver/blog/2014/05/05/calculatio...
I currently have some calculations made by the default, and written regarding the "HowTo Write default logic".
Despite of this, i found that system makes a while at each sent data, and i 'd like to replace that by a write back badi.
I've a dozen of WHEN/ENDWHEN in my script, and one CALC_ACCOUNT execution.
In an other projet i made before, i've already used write back badi.
But, the principle was quite different, because we used it to send data on node.
In my current case, i'd like to make calculation on base level.
I'm quite beginner in Badi Implementation ; and i'd like to adapt the standard wrtie badi from the existing How To to make those simple calculations like :
*WHEN SUBGROUP
*IS %LIA_CLAS%
*WHEN ACCOUNT
*IS %CPTE_VOPTE%
*REC(EXPRESSION=%VALUE%,BU=SUBGROUP.BU_DIV)
*ENDWHEN
*ENDWHEN
...
*INCLUDE CALCACCOUNT.LGF
Tks for your tips,
BR,
Olivia.
Hi Olivia,
It looks like there is much more to that implementation than a naked eye can see, like in your script.
It seems like your script just aggregates data based on BU_DIV Property of Dimension SUBGROUP. Now the question is: do you want to aggregate only records that came from Input template (DM load) or all records in your Model? Before you answer that simple question think about existing records: result of that aggregation will override existing records, not add to them. So, if you have some records already aggregated and stored in the Model and some just changed in the template your result will reflect only changed records. I.e. it won't be correct aggregation.
If you still insist that you want aggregating only changed records then approach Vadim suggested will serve you well.
If you decided that you want to aggregate not only changed records, then you'd need to read records from the Model and it becomes a little more complex.
Good luck,
Gersh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Gersh,
Tks for this reply,
For my better understanding, let me ask some more questions just to be sure my understanding is correct :
It seems like your script just aggregates data based on BU_DIV Property of Dimension SUBGROUP.
Now the question is:
do you want to aggregate only records that came from Input template (DM load)
or all records in your Model?
Before you answer that simple question think about existing records: result of that aggregation will override existing records, not add to them.
So, if you have some records already aggregated and stored in the Model and some just changed in the template your result will reflect only changed records. I.e. it won't be correct aggregation.
I'm not sure to well understand : through default logic, while I send data, on the database, data overwrite the existing data right, just by replacing them. Am I correct ?
Through the write back , system only take the difference.
thus I need to ask the write to read data on the model to agregate the difference made by the badi , with the data existing in the model .
Please see the default logic in attached file.
Tks for your help,
Hi Olivia,
I have some questions about your default.lgf!
Let's assume:
*SELECT (%LIA_SIMP%,"[ID]",SUBGROUP,"CALC='N' AND TYPLIA='SIM'")
*SELECT (%CPTE_VOPT%,"[ID]",ACCOUNT,"CALC='N' AND VENTIL_OPT='X'")
*WHEN SUBGROUP
*IS %LIA_CLAS%
*WHEN ACCOUNT
*IS %CPTE_VOPT%
*REC(EXPRESSION=%VALUE%,BU=SUBGROUP.BU_DIV)
*ENDWHEN
*ENDWHEN
In BU dimension you have something like: BU1,BU2,BU3,BU4,BU5
In SUBGROUP you have (ID and BU_DIV) with TYPLIA='SIM':
S1 BU4
S2 BU5
Then you have input schedule:
BU | SUBGROUP | VALUE |
---|---|---|
BU1 | S1 | 10 |
BU2 | S1 | 20 |
BU3 | S2 | 30 |
If you send values 10 and 20 simultaneously then result will be:
BU=BU4, SUBGROUP=S1 Value=30 (aggregation will happen 10+20)
But if you send only 10 the result will be:
BU=BU4, SUBGROUP=S1 Value=10
Independent of existing value 20... No aggregation.
Vadim
Hi Olivia,
You are partially correct: all logic overrides existing data, not only default.
It looks like there is some confusion between write back BADI and BPC write back process. WB BADI doesn't calculate the difference, WB process does. But forget about the difference, this is just technical implementation.
Please focus on what you want to see in your reports: All data in SUBGROUP accumulated to BU or only the part that is changed in the Input template?
Regards,
Gersh
Hi Olivia,
There is nothing complex in the WHEN/ENDWHEN loop to be implemented in the write back badi.
Write back badi will receive in the ct_array all changed values. First you have to get SUBGROUP BU_DIV property in some table. Then you have to loop the records in ct_array, check for members of the dimensions (SUBGROUP and ACCOUNT) and if the condition is matched write value to some temporary table with correct BU member. Then you have to aggregate values in this table by BU.
Then - append records of this table to ct_array.
Vadim
For calcaccount - you have to explain the logic...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
14 | |
2 | |
2 | |
1 | |
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.