Skip to Content
0

Scoping in Default Logic

Aug 07, 2017 at 09:48 AM

39

avatar image
Former Member

Hello,

If I have a simple default logic (see below for code), do I need to scope it? whats the advantage or disadvantage of it?

Thanks.

*WHEN HR_ACCT

*IS AC_611000

*REC(EXPRESSION=%VALUE%)

*ENDHWEN

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
Vadim Kalinin Aug 07, 2017 at 11:01 AM
0

First of all this code do nothing :)

In general you have to avoid scoping in default logic - you have to work with the scope passed after writing data to model.

Please read: https://blogs.sap.com/2014/06/09/how-to-write-defaultlgf/

Show 9 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Yeah, it was just a sample :) will read through your notes, thanks a lot Vadim.

0

You may also read my other blog: https://blogs.sap.com/2014/05/05/calculations-in-write-back-badi-defaultlgf-replacement/

to understand the difference between scope of default.lgf and the data records passed to write back badi.

0
Former Member

Ok, I went through your article. One quick question: I understood that no XDIM scoping is needed when its default logic. However, what if the users are planning to use default logic run DM package? in a scenario like this, would you recommend using XDIM_Memberset?

Thanks.

0

"to use default logic run DM package" - sorry, what do you mean?

default.lgf is a script, not a DM package!

0
Former Member

Yes but you can use a DM package to run Default logic script right? in a scenario like that, do you need to scope it?

Thanks.

0

Yes, you can use DM package to run default.lgf but what is the benefit??

It's better to create another script dedicated to be launched by DM. In this script for sure you will use *XDIM_MEMBERSET scoping!

0
Former Member
Vadim Kalinin

But in that case you will have two scripts to maintain in every model/app. What would be downside of using XDIM_MEMBERSET in that scenario? I understand it doesnt really mean anything when default is triggered by input form, but it doesnt hurt does it?

0

Yes, you have to maintain 2 scripts!

1. If you define scope in default.lgf then calculations will happen for this scope independent of user data entry - will slow down save execution. For example you defined some scope for ACCOUNT. Then even if user is not saving data for this account the default.lgf will perform calculations!

2. Please read about different sign calculation logic in my document!

0

"I understand it doesnt really mean anything when default is triggered by input form" - incorrect understanding, please read again: https://blogs.sap.com/2014/06/09/how-to-write-defaultlgf

0
Vadim Kalinin Aug 07, 2017 at 11:49 AM
0

Just some samples:

If ACCOUNT is A1 then multiply value by A2 and write result to A3

default.lgf (for data saved by input form)

*WHEN ACCOUNT
*IS A1
*REC(EXPRESSION=%VALUE%*[ACCOUNT].[A2],ACCOUNT=A3)
*ENDWHEN

DM package script to perform this calculation for user defined scope:

*XDIM_MEMBERSET ACCOUNT=A1 //fixed scope for ACCOUNT
*XDIM_MEMBERSET TIME=%TIME_SET% // user scope for TIME
*XDIM_MEMBERSET ENTITY=%ENTITY_SET%
//...
*WHEN ACCOUNT
*IS * //already scoped
*REC(EXPRESSION=%VALUE%*[ACCOUNT].[A2],ACCOUNT=A3)
*ENDWHEN
Show 1 Share
10 |10000 characters needed characters left characters exceeded

P.S. sign calculation is different for default.lgf and script launched by DM package (please read my document!)

0