cancel
Showing results for 
Search instead for 
Did you mean: 

Can I use Logic Script conditions to determine whether to CALL A BADI or not?

maleodillet
Participant
0 Kudos

Hi Experts,

I have a requirement; there is this input template which contains a hidden EPMSAVEDATA which essentially saves a flag (1, -1, or 0) to that members combination and we would like to leverage that saved value (1, -1, or 0 ) and use it as a "condition" in the a Logic Script file to determine whether or not we call a BADI.

Essentially the logic script file will scoop the parameters from that EPMSAVEDATA on the input template and if the result is "1" it will call the BADI otherwirse don't do anything.

Based on my experience it is not doable at all, but I figured there may be somebody out there who has had this or a similar requirement. Any help will be much appreciated.

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member186338
Active Contributor
0 Kudos

After looking on the sequence of events I don't understand the issue!

Your custom logic badi can read this flag inside badi and depending on this flag - do nothing!

P.S. There is no way in script logic to perform conditional badi execution depending on transactional data. But why not to check flag in the badi???

maleodillet
Participant
0 Kudos

Vadim,

I agree completely on adding this within the BADI, but since we were trying to use a code that is already built we didn't want to make additional changes,however, it looks to me like we would have to enhance it and add the flag evaluation flag to the BADI and just call it from the Default.Lgf right?

former_member186338
Active Contributor
0 Kudos

Sorry, but default.lgf has NO relation to the scenario you described!

Add ~20 lines of code to the Custom logic badi you have. For sure your flag has to be set for some dummy account having other dimensions same as on the report.

Still the scenario is not clear for me: what do you want to achieve using this flag from the business point of view???

May be there is a better solution?

maleodillet
Participant
0 Kudos

So where do I call the BADI from if not from the Logic Script File, I am a bit confused.

What we are trying to do with that flag is to tell the BADI "the supervisor clicked APPROVE = 1, the supervisor clicked REJECT = -1"

former_member186338
Active Contributor
0 Kudos

Sorry, but you are mixing terms!

default.lgf is not equal to script logic. You can have script logic in any lgf file launched by DM package!

Currently you call badi not from default.lgf, but from xxxx.lgf launched by DM package.

"the supervisor clicked APPROVE = 1, the supervisor clicked REJECT = -1" - strange idea, why not to use work status for approval??? And workflow...

former_member186338
Active Contributor
0 Kudos

P.S. And silence ...

maleodillet
Participant
0 Kudos

Hi Vadim,

I am truly sorry for the late response, but I got caught up on something else.

Again, you're right on using work status for this requirement, but the client wants to allow for multiple submissions and have the ability to go back to the numbers and change them if needed and avoid locking the data.

I thought we could Call the BADI from the Default.Lgf by using "CALL BADI XXXXX" or "*START BADI/END BADI" in it.

former_member186338
Active Contributor
0 Kudos

"Again, you're right on using work status for this requirement, but the client wants to allow for multiple submissions and have the ability to go back to the numbers and change them if needed and avoid locking the data." - sorry, but I do no understand why it's not possible with work status???? Sorry, but looks like you are trying to reinvent the wheel 🙂

"I thought we could Call the BADI from the Default.Lgf by using "CALL BADI XXXXX" or "*START BADI/END BADI" in it." - sorry - still not clear how default.lgf is related to your scenario? default.lgf is running on data save, but you need to check flag later!

former_member186338
Active Contributor

P.S. My experience tells me that you are trying to do something strange 🙂

former_member186338
Active Contributor
0 Kudos

Doable!

But you need to explain sequence of events!

Are you talking about default.lgf?

May be it's better to think about write back badi that will see write to some specific intersection and perform required calculations?

maleodillet
Participant
0 Kudos

Hi Vadim,

Thanks for your response. Not really, we were actually talking about writing this potential Logic into a separate Logic Script file not the Default.lgf

we are planning the sequence of events as following;

1- Enter the data in the template and save it back to the server. Data in the data intersections gets saved as well as the flag (1, -1, or 0) coming from the EPMSAVEDATA function based of a different set of members combination.

2- The supervisor then opens the report and verifies the numbers, if he agrees with it he'll then click a Macros button (APPROVE) to approve

The MACROS (APPROVE) when clicked would execute a DM which would contain that potential Script Logic that evaluates the flag previously saved with EPMSAVEDATA (1,-1,or 0) and decides whether or not to execute the BADI we have written.

If the BADI is executed it will tell the system to move this set of data that has previously been saved from one CATEGORY member to the next one at a higher level in the hierarchy.

Note; The next category level for which the data needs to be moved varies based on the current member selection. It is not simply following the hierarchy order, that is what the BADI takes care of.

Thanks