Skip to Content
0

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

Feb 13 at 07:18 PM

30

avatar image

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.

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

2 Answers

Best Answer
Vadim Kalinin Feb 13 at 07:31 PM
0

"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.

Share
10 |10000 characters needed characters left characters exceeded
Maleo Dillet Feb 13 at 07:43 PM
0

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!
Show 5 Share
10 |10000 characters needed characters left characters exceeded

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

Have you understood the idea in general?

0

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.

0

"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.

1

Excellent.Thanks again!

0

Then, please accept the correct answer!

0