cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

DYNAMIC AGGREGATION of USING SCRIPT LOGIC /BPC 10.1 Standard

maleodillet
Participant
0 Likes
728

Hi Gurus,

I have a very complicated Requirement in which I need member A (INPUT_RECURRING) to always be added with member B (FROM_TRAVEL) and store this aggregated value back to member A (INPUT_RECURRING). Essentially, I am trying to mimic a parent node aggregation of two member that sit at different levels of the hierarchy.

I did manage to write a logic script that does that and placed it in the default logic but every time we save a new record it doubles the aggregation since it does not know when to stop aggregating.

I was hoping to get some guidance onto how to achieve this requirement differently. Thanks in advance

Here is the script I wrote;

*XDIM_MEMBERSET AUDIT_TRAIL AS %INP_RECURR% = INPUT_RECURRING, FROM_TRAVEL
*XDIM_MEMBERSET AUDIT_TRAIL=%INP_RECURR%

*WHEN CURRENCY
*IS LC
    *WHEN AUDIT_TRAIL
    *IS %INP_RECURR%
    *REC(EXPRESSION=%VALUE%*1,AUDIT_TRAIL=INPUT_RECURRING,CURRENCY=LC)
    *ENDWHEN
*ENDWHEN


Accepted Solutions (1)

Accepted Solutions (1)

former_member186338
Active Contributor
0 Likes

First of all, please read my blog: https://blogs.sap.com/2014/06/09/how-to-write-defaultlgf/

You will understand why *XDIM_MEMBERSET is a bad idea. When you overwrite the scope it will be executed for any write to the cube!

After some analysis I have found that it's not possible to achieve the required logic in default.lgf - due to default.lgf scope issue (read my blog!).

Only write back badi will do the job!

Answers (2)

Answers (2)

maleodillet
Participant
0 Likes

Thanks Vadim. I will look into the Write Back then

maleodillet
Participant
0 Likes

Hi Vadim,

Thanks a lot for your fast response. Right below is the complete Logic Script I am using in the DEFAULT.LGF and also I have added a sequence of screenshots explaining my business case

*XDIM_MEMBERSET AUDIT_TRAIL AS %INP_RECURR% = INPUT_RECURRING, FROM_TRAVEL
*XDIM_MEMBERSET AUDIT_TRAIL AS %INP_NON_RECURR% = INPUT_NON_RECURRING, FROM_TRAVEL_NR
*XDIM_MEMBERSET AUDIT_TRAIL = %INP_RECURR%,%INP_NON_RECURR%
*XDIM_MEMBERSET CURRENCY = LC

*WHEN AUDIT_TRAIL
	*IS %INP_RECURR%
	*REC(EXPRESSION = %VALUE%*1,AUDIT_TRAIL = INPUT_RECURRING,CURRENCY = LC)
*ENDWHEN
*WHEN AUDIT_TRAIL
	*IS %INP_NON_RECURR%
	*REC(EXPRESSION = %VALUE%*1,AUDIT_TRAIL = INPUT_NON_RECURRING,CURRENCY = LC)
*ENDWHEN
*COMMIT

*INCLUDE STEP2_RECOSTING_AUTO.LGF

The *INCLUDE statement at the end should then run a BADI with the new aggregated value in INPUT_RECURRING or INPUT_NON_RECURRING to calculate some ratios.

Thanks again.