cancel
Showing results for 
Search instead for 
Did you mean: 

How to execute a DM to call a BADI using a .LGF

maleodillet
Participant
0 Kudos

Hi gurus,

I calling a BADI thru a DM that we have modified to not ask the user any prompts. The .LGF within the DM that contains the *START/END_BADI is not the default one since we need to see the data saved in the system before we call the BADI to run its logic. The problem I have is that when I click on the Macros that runs the DM there is no parameters or variables passed since there is no prompts to select from. All the DM does is pretty much just execute the .LGF that calls the BADI and therefore the BADI takes all the members and all dimensions when running and we just want it to run for the parameters (members) from the current report context. How can I achieve this requirement? Please advise.

Accepted Solutions (1)

Accepted Solutions (1)

former_member186338
Active Contributor
0 Kudos

"the BADI takes all the members and all dimensions when running and we just want it to run for the parameters (members) from the current report context" ??? - BADI know nothing about report context 🙂

"we have modified to not ask the user any prompts" - bad idea!

You can use vba to call DM and to pass parameters to DM: https://blogs.sap.com/2017/06/16/simple-vba-function-to-pass-parameters-to-dm-packages/

You can pass context scope using this VBA code (pass SELECTION variable).

Then the script will have the report scope and BADI can read the current scope.

P.S. Another option is to use PROMPT(SELECTINPUT... parameter to get a current scope, but the user will need to press extra keys.

Answers (1)

Answers (1)

maleodillet
Participant
0 Kudos

Hi Vadim, Thanks for the fast response. Do you have a different link than the one on your response, that one says "We are sorry, but the site you are looking for is temporarily out of service" Thanks

              Please try again later!
former_member186338
Active Contributor
0 Kudos

Unfortunately the whole SAP blog platform is down for at least 6 hours! Waiting for restore...

Have you understood the idea in general?

maleodillet
Participant
0 Kudos

Yes, Vadim. I do, I am actually also working on a VBA code to pass the selection variables with macros. I truly appreciate your help.

one more thing thou, since modifying a standard DM prompts is not such a good Idea, which Data Package Manager would you recommend using? since I do not need any transformation file being loaded.

former_member186338
Active Contributor

"since modifying a standard DM prompts is not such a good Idea" ??? What do you mean?

To run some script logic you have to use new DM package based on the chain:

/CPMB/DEFAULT_FORMULAS

instead of

PROMPT(SELECTINPUT,,,,"%CATEGORY_DIM%,%CURRENCY_DIM%,%TIME_DIM%")

use the list of dimensions in your model.

In my blog you will see how to pass %SELECTION% variable using VBA.

maleodillet
Participant
0 Kudos

Excellent.Thanks again!

former_member186338
Active Contributor
0 Kudos

Then, please accept the correct answer!