cancel
Showing results for 
Search instead for 
Did you mean: 

How to transfer data between models through BADI (CUSTOM LOGIC)?

adolfo_vigo
Explorer
0 Kudos

Hi community,

I'm working on SAP BPC 10.1 Standard and i have the following requirement. We need to move data between two models with a custom logic BADI. Why we can not use *DESTINATION APP?

We need to save data in the ZACCOUNT, and these members are defined in the source dimension ACCOUNT. The correct would use something like ACCOUNT.ZACCOUNT_A, but in this case the destination ZACCOUNT is not defined in base members, is define in parent nodes and we can not define at base level. So, we would like to know if its possible by script logic or the most probably, it would be possible by BADI? Which is the sentence or how we can move data between models in BADI, how would be the code? A little example.

BADIs reads correctly parent members data, so we only need to read their ZACCOUNT property and move to other model. But we don't know how to do it through BADI.

Product version:

SAP BPC 800 SPS 10 (04/2013)

SAP BW 750 0022

Thanks in advance

Accepted Solutions (1)

Accepted Solutions (1)

former_member186338
Active Contributor

adolfo_vigo

First of all, remove:

*XDIM_MEMBERSET ACCOUNT = %NODOS_ACCOUNT%

Then, my mistake:

instead of:

*IS BAS(%NODOS_ACCOUNT%)

use:

*IS BAS(%NODOS%)

Just Copy/Paste issue!

adolfo_vigo
Explorer
0 Kudos

Excuse me, we answer at the same time. I've tried that too (before your last answer). It could be possible that beacuse models measures are different, now it does not save?

adolfo_vigo
Explorer
0 Kudos

Thanks a lot. That was right, because i limited the scope to the parent members, script does not go to the base level.

Thank you very much Vadim

Answers (5)

Answers (5)

former_member186338
Active Contributor

Try multiple variables in *FOR:

*SELECT(%NODOS_ZACCOUNT%,ID,ACCOUNT,ZACCOUNT_AB <> '')
*SELECT(%ZACCOUNTS%,ZACCOUNT_AB,ACCOUNT,ZACCOUNT_AB <> '')

*DESTINATION_APP = ZMODEL_2
*ADD_DIM AUDIT_TRAIL = LOAD
*ADD_DIM ZCONCEPT = NO_CONCEPT
*RENAME_DIM FLOW = ZFLOW
*RENAME_DIM ACCOUNT = ZACCOUNT
*SKIP_DIM = SCOPE

*WHEN ACCOUNT
*FOR %NODOS%=%NODOS_ZACCOUNT% AND %ZACCOUNT%=%ZACCOUNTS%
*IS BAS(%NODOS_ZACCOUNT%)
*REC(EXPRESSION=%VALUE%,ACCOUNT=%ZACCOUNT%,MEASURES=PERIODIC)
*NEXT
*ENDWHEN
adolfo_vigo
Explorer
0 Kudos

Thanks Vadim but it didn't work. The script i have used:

*SELECT(%NODOS_ACCOUNT%,"[ID]","ACCOUNT",ZACCOUNT_A <> '')

*SELECT(%ZACCOUNTS%,"[ZACCOUNT_A]","ACCOUNT",ZACCOUNT_A <> '')

*XDIM_MEMBERSET ACCOUNT = %NODOS_ACCOUNT%

*XDIM_MEMBERSET CATEGORY = ACT

*XDIM_MEMBERSET DATASRC = INPUT

*XDIM_MEMBERSET ENTITY = 0070

*XDIM_MEMBERSET FLOW = F99

*XDIM_MEMBERSET INTERCO = INONE

*XDIM_MEMBERSET RPTCURRENCY = LC

*XDIM_MEMBERSET SCOPE = NON_GROUP

*XDIM_MEMBERSET TIME = 2021.12

*DESTINATION_APP = ZMS_REP_PACKAGE

*ADD_DIM AUDIT_TRAIL = LOAD

*ADD_DIM ZCONCEPT = NO_CONCEPT

*RENAME_DIM FLOW = ZFLOW

*RENAME_DIM ACCOUNT = ZACCOUNT

*SKIP_DIM = SCOPE

*WHEN ACCOUNT

*FOR %NODOS%=%NODOS_ACCOUNT% AND %ZACCOUNT%=%ZACCOUNTS%

*IS BAS(%NODOS_ACCOUNT%)

*REC(EXPRESSION=%VALUE%,ACCOUNT=%ZACCOUNT%)

*NEXT

*ENDWHEN

Now, i only have this data in model 1, so the member destiny it will be A000004:

But the result shows something like this:

*WHEN ACCOUNT

*IS BAS(61111,61112,61113,6112,6113,61141,61143,6115,6116,6121,6122,612313,612314,612315,612316,612317,612318,612319,61231A,61231C,61231D,61233,612341,612342,612343,6123441,6123442,6123451,6123452,6123453,6123454,6123455,6123456,6124,6125,6126,6127,62111,62112,6211311,6211312,62114,621151,62117,621181,621211,621221,621231,6212321,621233,6221,62211331,62211332,6221321,6221322,6221323,6221324,6221325,6221326,6221328,622132A,62221,62222,62223,62224,6223,6224,62251,6228,6231,6232,62331,62332,62333,62334,62342,623513,623514,623515,623516,62351A,62351B,62353,62354,62361)

*REC(EXPRESSION=%VALUE%,ACCOUNT=A000004)

*IS BAS(61111,61112,61113,6112,6113,61141,61143,6115,6116,6121,6122,612313,612314,612315,612316,612317,612318,612319,61231A,61231C,61231D,61233,612341,612342,612343,6123441,6123442,6123451,6123452,6123453,6123454,6123455,6123456,6124,6125,6126,6127,62111,62112,6211311,6211312,62114,621151,62117,621181,621211,621221,621231,6212321,621233,6221,62211331,62211332,6221321,6221322,6221323,6221324,6221325,6221326,6221328,622132A,62221,62222,62223,62224,6223,6224,62251,6228,6231,6232,62331,62332,62333,62334,62342,623513,623514,623515,623516,62351A,62351B,62353,62354,62361)

*REC(EXPRESSION=%VALUE%,ACCOUNT=A000005)

*IS BAS(61111,61112,61113,6112,6113,61141,61143,6115,6116,6121,6122,612313,612314,612315,612316,612317,612318,612319,61231A,61231C,61231D,61233,612341,612342,612343,6123441,6123442,6123451,6123452,6123453,6123454,6123455,6123456,6124,6125,6126,6127,62111,62112,6211311,6211312,62114,621151,62117,621181,621211,621221,621231,6212321,621233,6221,62211331,62211332,6221321,6221322,6221323,6221324,6221325,6221326,6221328,622132A,62221,62222,62223,62224,6223,6224,62251,6228,6231,6232,62331,62332,62333,62334,62342,623513,623514,623515,623516,62351A,62351B,62353,62354,62361)

*REC(EXPRESSION=%VALUE%,ACCOUNT=A000005)

......But nevertheless, it does not save any data. It seems too that in case that it works, it will be save data from all NODOS_ACCOUNT in each ZACCOUNT member.I wonder, how we can say that for member ACCOUNT 61111 it corresponds A0000004, this match is the key. The result should be like:

WHEN ACCOUNT

*IS BAS(61111)

*REC(EXPRESSION=%VALUE%,ACCOUNT=A000004)

*IS BAS(61112)

*REC(EXPRESSION=%VALUE%,ACCOUNT=A000005)

.....Thanks again!
adolfo_vigo
Explorer
0 Kudos

Model 1 : Year to date

Model 2: Periodic

This affect?

adolfo_vigo
Explorer
0 Kudos

I've tried this:

*SELECT(%NODOS_ZACCOUNT%,"[ID]","ACCOUNT",ZACCOUNT_A <> '')

*SELECT(%ZACCOUNTS%,"[ZACCOUNT_A]","ACCOUNT",ZACCOUNT_A <> '')

*DESTINATION_APP = ZMS_REP_PACKAGE

*ADD_DIM AUDIT_TRAIL = LOAD

*ADD_DIM ZCONCEPT = NO_CONCEPT

*RENAME_DIM FLOW = ZFLOW

*RENAME_DIM ACCOUNT = ZACCOUNT

*SKIP_DIM = ACTIVITY,DATASRC,PROFITCTR,RECURRENCE,SCOPE

*WHEN ACCOUNT

*FOR %NODOS%=%NODOS_ZACCOUNT% AND %ZACCOUNT%=%ZACCOUNTS%

*IS BAS(%NODOS%)

*REC(EXPRESSION=%VALUE%,ACCOUNT=%ZACCOUNT%)

*NEXT

*ENDWHEN

And the result seems good:

WHEN ACCOUNT

*IS BAS(61111)

*REC(EXPRESSION=%VALUE%,ACCOUNT=A000004)

*IS BAS(61112)

*REC(EXPRESSION=%VALUE%,ACCOUNT=A000005)

*IS BAS(61113)

*REC(EXPRESSION=%VALUE%,ACCOUNT=A000005)

*IS BAS(6112)

*REC(EXPRESSION=%VALUE%,ACCOUNT=A000006)

*IS BAS(6113)

*REC(EXPRESSION=%VALUE%,ACCOUNT=A000007)

*IS BAS(61141)

*REC(EXPRESSION=%VALUE%,ACCOUNT=A000008)

*IS BAS(61143)

*REC(EXPRESSION=%VALUE%,ACCOUNT=A000010)

*IS BAS(6115)

But it does not save any data:

ENDWHEN ACCUMULATION: 0 RECORDS ARE GENERATED.

SCRIPT RUNNING TIME IN TOTAL:4.00 s.

LOG END TIME:2022-10-06 11:30:28

former_member186338
Active Contributor

Check scope!

former_member186338
Active Contributor
0 Kudos

It's possible to use script logic but you need to provide more details.

BADI is always an option.

adolfo_vigo
Explorer
0 Kudos

Thanks for the answer Vadim. What we require is this:

  • We have two models:

Model 1: data is store in ACCOUNTS, but the destination to the model 2 ZACCOUNT member is defined in the parenth member (property ZACCOUNT_A)

So, when i have tried to implement script logic i was unable to match the parent property to its corresponding. We know if the proerty was defined in base level it would be possible, but in parent we don't know how to match it. We try somenthing like two fors (but you have said SELECTS does not work in FOR/NEXT, and destination app is only for WHEN/ENDWHEN):

*SELECT(%NODOS_ZACCOUNT%,"[ID]","ACCOUNT",ZACCOUNT_AB <> '')

*SELECT(%ZACCOUNT%,"[ZACCOUNT_A]","ACCOUNT",ID=%NODOS_ZACCOUNT%)

*DESTINATION_APP = ZMODEL_2

*ADD_DIM AUDIT_TRAIL = LOAD

*ADD_DIM ZCONCEPT = NO_CONCEPT

*RENAME_DIM FLOW = ZFLOW

*RENAME_DIM ACCOUNT = ZACCOUNT

*SKIP_DIM = SCOPE

*FOR %NODOS%=%NODOS_ZACCOUNT%

*WHEN ACCOUNT

*IS BAS(%NODOS_ZACCOUNT%)

*FOR %PROPIEDAD% = %ZACCOUNT%

*WHEN ACCOUNT.ZACCOUNT_AB

*IS %PROPIEDAD%

*REC(EXPRESSION = %VALUE%, ACCOUNT =%PROPIEDAD%,MEASURES=PERIODIC)

*ENDWHEN

*NEXT

*ENDWHEN

*NEXT

Besides, we think too in doing this from model 2, with a LOOKUP, but how we can match member to its father? How we can s

*LOOKUP MODEL_1

*DIM MEASURES = YTD

*DIM ZZACCOUNT:ACCOUNT = ZACCOUNT.ID

*ENDLOOKUP

*WHEN ZACCOUNT

*IS *

*REC(EXPRESSION = LOOKUP(ZZACCOUNT))

*ENDWHEN

Thanks, if you need more information tell me.

Regards

adolfo_vigo
Explorer
0 Kudos

I've found an answer from vadim.kalinin that says (from https://answers.sap.com/questions/597600/update-different-infocubes-in-the-same-ujcustomlog.html 😞

Yes, it's possible using lo_ujo_wb = cl_ujo_wb_factory=>create_write_back() and then lo_ujo_wb->write_back(...

Please read: https://www.sap.com/documents/2015/08/6c91e080-5b7c-0010-82c7-eda71af511fa.html

Ct_data is used for current model only. If you want to write to not current model then write back method has to be used. For current model both methods can be used. Please test yourself




We are not entirely clear how to use that to fulfill our requirement yet.