Tuesday, March 13, 2012

WHEN_REF_DATA?



At times in SAP Business Planning and Consolidation, when writing a *WHEN-*REC-*ENDWHEN structure in script logic, we may come across a scenario where we want to post value to an intersection/region where there is no data. This was not supported previously as calculations happen in transaction mode by default.
The above is not a limitation anymore in SAP BPC NW with the new script logic keyword -*WHEN_REF_DATA. This allows us to switch our calculation mode to either transaction data or master data.
Syntax
1)      To enable master data mode
*WHEN_REF_DATA = MASTER_DATA   
//*WHEN-*REC-*ENDWHEN CONSTRUCT

2)      To enable transaction data mode
*WHEN_REF_DATA = TRANS_DATA  
//*WHEN-*REC-*ENDWHEN CONSTRUCT

  • In transaction data mode, calculations will happen based on the transaction data in the source data region
  • In master data mode, calculations will happen based on the Cartesian product of the source data region no matter if the transaction data exists or not
  • The mode is set to transaction by default. So when we do not use this keyword in our logic, all the calculations in *WHEN construct will happen in transaction mode
  • When we use the *WHEN_REF_DATA statement, all the calculations in following *WHEN  constructs will happen in the mode specified until the next *WHEN_REF_DAT (if specified) 
Example
*XDIM_MEMBERSET TIME=2010.MAR
*WHEN ACCOUNT
*IS  ACC1
*REC(EXPRESSION=1000, ACCOUNT=ACC2)
*ENDWHEN
Here we have no *WHEN_REF_DATA and thus calculations will happen in the default mode i.e. transaction data mode. A value of 1000 will be written to ACC2 wherever there is a value for ACC1 in the period 2010.MAR.
Now, let us look at the same example in master data mode.
*XDIM_MEMBERSET TIME=2010.MAR
*WHEN_REF_DATA = MASTER_DATA  
*WHEN ACCOUNT
*IS  ACC1
*REC(EXPRESSION=1000, ACCOUNT=ACC2)
*ENDWHEN

Akshay Vellanki
Partner & Director EPM Practice
Techincept Consulting Inc.
SAP BPC Training
http://www.techincept.com/
310-956-1113
AkshayVellanki@gmail.com
www.techincept.com/sapbpctraining.html

1 comment: