Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

How to copy data between models in BPC script logic

Let’s discuss a simple case: We have 2 PERIODIC models: SOURCE_MODEL and TARGET_MODEL with identical set of dimensions:

  • ACCOUNT
  • AUDITTRAIL
  • ENTITY
  • CATEGORY
  • TIME
  • CURRENCY

And we want to copy some scope from source to target using Script logic launched by DM package.

Looks like the script will be:

*XDIM_MEMBERSET ACCOUNT=A1,A2,A3
*XDIM_MEMBERSET AUDITTRAIL=DS1
*XDIM_MEMBERSET ENTITY=DE
*XDIM_MEMBERSET CATEGORY=BUDGET
*XDIM_MEMBERSET TIME=2018.11
*XDIM_MEMBERSET CURRENCY=LC

*DESTINATION_APP=TARGET_MODEL

*WHEN TIME
*IS *
  *REC(EXPRESSION=%VALUE%)
*ENDWHEN

But there is an issue in case you perform copy multiple times (due to data changes in SOURCE_MODEL). For example:

  1. First copy: A1 account has value 10 in SOURCE_MODEL. A1 account in TARGET_MODEL will be also 10.
  2. Then the user decided to delete A1: 10 Result A1: 0 in SOURCE_MODEL
  3. Then Lite Optimization with Zero Elimination was performed for SOURCE_MODEL. Result A1: Empty in SOURCE_MODEL
  4. Second copy: Due to missing record for A1 in SOURCE_MODEL nothing will be copied to TARGET_MODEL. Result A1: 10 in TARGET_MODEL – incorrect!

To get a correct results in TARGET_MODEL we have to clear target scope before copy!

Clearing can be done with simple script (CLEAR.LGF) like:

//CLEAR.LGF
*WHEN TIME
*IS *
  *REC(EXPRESSION=0)
*ENDWHEN

But this script has to be launched in the TARGET_MODEL. In order to do it in the same script in SOURCE_MODEL we have to implement RUNLOGIC_PH BADI.

How To Implement the RUNLOGIC_PH Keyword in SAP Business Objects Planning and Consolidation 10.0, version for NetWeaver

Then the script in the SOURCE_MODEL will be:

//Clear scope
START_BADI RUNLOGIC_PH
QUERY = OFF
WRITE = ON
DEBUG = OFF
LOGIC = CLEAR.LGF //Clear script in TARGET_MODEL
//APPSET = Don't specify APPSET - current will be used!
APP = TARGET_MODEL
DIMENSION ACCOUNT=A1,A2,A3 
DIMENSION AUDITTRAIL=DS1
DIMENSION ENTITY=DE
DIMENSION CATEGORY=BUDGET
DIMENSION TIME=2018.11
DIMENSION CURRENCY=LC
END_BADI //this line will reset scope!

//Copy data
//You have to scope after END_BADI!
*XDIM_MEMBERSET ACCOUNT=A1,A2,A3
*XDIM_MEMBERSET AUDITTRAIL=DS1
*XDIM_MEMBERSET ENTITY=DE
*XDIM_MEMBERSET CATEGORY=BUDGET
*XDIM_MEMBERSET TIME=2018.11
*XDIM_MEMBERSET CURRENCY=LC

*DESTINATION_APP=TARGET_MODEL

*WHEN TIME
*IS *
  *REC(EXPRESSION=%VALUE%)
*ENDWHEN

Using the above script the results will be correct!



This post first appeared on Web Service Testing A Blackjack GUI And API, please read the originial post: here

Share the post

How to copy data between models in BPC script logic

×

Subscribe to Web Service Testing A Blackjack Gui And Api

Get updates delivered right to your inbox!

Thank you for your subscription

×