cancel
Showing results for 
Search instead for 
Did you mean: 

Ability to add filter before executing a BAdI – Script Logic

former_member234894
Participant
0 Kudos

Hi Experts,

 

I am attemptintg to run run a BAdI that performs a reclassification entry (not so important what the BAdI does) via a Data Manager package that selects Category/Entity/Time

The user will select his/her entity, and I would like to ensure that the entity selected has a property = Y before executing.

 

Having problems creating this script logic.  Can you assist.

 

  1. Tried additing a property via XDIM_FILTER, but that did not filter.  The DM/BAdI ran on the entities chosen.
  2. Tried adding a *WHEN clause to limit the execution of the BAdI before the START command, but Script logic does not accept the syntax.

Below is the script logic.

  Any ideas?
Thanks.

  Eyal

// EVALUATE WHETHER TO FILTER OR NOT FOR SCOPE. TBD

//*XDIM_MEMBERSET SCOPE = S_NONE

  *XDIM_MEMBERSET FLOW = F99

  *XDIM_MEMBERSET CURRENCY = LC,USD

  *XDIM_MEMBERSET SCOPE = S_NONE

  // VARIABLES TO SELECT

  *XDIM_FILTER Entity =
[Entity].properties("ENT_REC_DTAL") = "YES
"

 

  *// SELECTION TO ACTIVATE THE BADI 

*XDIM_MEMBERSET ACCOUNT = BAS(151000),BAS(225000)

*XDIM_MEMBERSET AUDITID = BAS(AD3100)

// SELECT THE VARIABLES FROM THE DM

*XDIM_MEMBERSET CATEGORY = %CATEGORY_SET%

*XDIM_MEMBERSET ENTITY = %ENTITY_SET%

*XDIM_MEMBERSET TIME = %TIME_SET%

*START_BADI ADAMA

QUERY = ON

  WRITE = ON

  *END_BADI

  //*ENDWHEN

Accepted Solutions (1)

Accepted Solutions (1)

former_member186338
Active Contributor
0 Kudos

Hi Eyal,

Strange code - first you filter, then override filtering with:

*XDIM_MEMBERSET ENTITY = %ENTITY_SET%


If you want to filter user input (to remove incorrect selection), then:


*SELECT(%E%,"[ID]",ENTITY,"[ID]=%ENTITY_SET% AND [ENT_REC_DTAL]='YES'")

*XDIM_MEMBERSET ENTITY=%E%


Vadim


P.S. Dimension names are case sensitive: *XDIM_FILTER Entity =
[Entity]
.properties("ENT_REC_DTAL") = "YES" - ????

former_member186338
Active Contributor
0 Kudos

Or even more simple solution:

At the beginning of the script the script scope will be based on user selection %ENTITY_SET%

Just add only filter (filter works with the initial script scope):

*XDIM_FILTER ENTITY = [ENTITY].properties("ENT_REC_DTAL") = "YES"

And no XDIM_MEMBERSET for ENTITY after!

Vadim

former_member234894
Participant
0 Kudos

This looks good in inital testing.

Thinking is that we let a user select the entity but only run the calculation in the BAdI if the entity has the property as YES.

Will tidy up the code.

Thanks again!

Eyal

former_member186338
Active Contributor
0 Kudos

By the way the option with SELECT will be fully equivalent to FILTER if SELECT will also check for base members:

*SELECT(%E%,"[ID]",ENTITY,"[ID]=%ENTITY_SET% AND [ENT_REC_DTAL]='YES' AND [CALC]='N'")

*XDIM_MEMBERSET ENTITY=%E%

same result as with:

*XDIM_FILTER ENTITY = [ENTITY].properties("ENT_REC_DTAL") = "YES"

Vadim

former_member200327
Active Contributor
0 Kudos

Hi Eyal,

I'd think that BADI will run anyway. Just C_T_DATA will be empty and I hope that in such case your code finishes fast.

Regards,

Gersh

Answers (0)