cancel
Showing results for 
Search instead for 
Did you mean: 

Default logic to copy changed or new records from source model to destination model

former_member488614
Participant
0 Kudos

Hello all, I have a requirement to copy data to target model when users enter/change any data in input sheets in the source model.

That should trigger my script logic calculation every time a record is saved in source Model, and only update the new values, incase if any changed record that should clear old record in target model and copy only changed record, we imported RUNLOGIC_PH BAdi, can I use this for my requirement? do I need to create a default logic in source model?

I created a script logic to work with by executing DM package with category selections, can I copy that logic and change the syntax to work with default logic? always user selects a category in the input sheets.

Thank you

Accepted Solutions (0)

Answers (3)

Answers (3)

former_member186338
Active Contributor

First please close your previous question accepting the correct answer.

former_member488614
Participant
0 Kudos

Found the solution, hence closing this thread.

Created DEFAULT.LGF in source model,included runlogic badi to clear the record in target model.

former_member186338
Active Contributor
0 Kudos

Unfortunately this approach will not work correctly.

former_member488614
Participant
0 Kudos

Hi Vadim, could you please let me know in which scenario this approach will not work?

I am clearing only changed record in the target using variables in scoping, like below.

*START_BADI RUNLOGIC_PH
QUERY=OFF
WRITE=ON
APP=PROJECTREPORTING
LOGIC=CLEAR.LGF
DIMENSION COSTELEMENT=%COSTELEMENT_SET%
DIMENSION DATASRC=%DATASRC_SET%
DIMENSION PO=%PO_SET%
DIMENSION PROJECT=%PROJECT_SET%
DIMENSION TIME=%TIME_SET%
DIMENSION CATEGORY=%CATEGORY_SET%
*END_BADI

this is clear in target model.
*WHEN CATEGORY
*IS *
*REC(EXPRESSION=0)
*ENDWHEN




former_member186338
Active Contributor
0 Kudos

"Clearing only changed record" is not required, changed record will overwrite!

former_member488614
Participant
0 Kudos

Yes, in my scenario I am loading properties data from source as dimensions in the target model, so if any changes in property value in the source it will not overwrite in target model because it will not find the unique key, so I am clearing that and loading new data.

Ex:- in source model

Dimension Property

Project Comm area Signdata

1 ABC $100

Target model

Dimension1 Dimension2

Project Comm area Signdata

1 ABC $100

Now the property Comm area is changed from ABC to XYZ in source model and user changed the sign data from $100 to $200, if I have not cleared this in target it will not overwrite and my records in target as

Dimension1 Dimension2

Project Comm area Signdata

1 ABC $100

1 XYZ $200

for this reason, I am clearing, apart from this is there any other scenarios which my approach is not going to work?

former_member488614
Participant
0 Kudos

Hi Vadim-I just closed my previous question accepting the correct answer.

Thank you.

former_member186338
Active Contributor
0 Kudos

Second question discussion is not finished!