Skip to Content
0

How to Call a Script Logic (LGF) file from VBA macro?

Nov 22, 2017 at 03:05 AM

133

avatar image
Former Member

Good Day,

I would like to know if there is a way to call the script logic (.lgf) file from vba macro?

What I'm trying to achieve is for the user run the data manager package through Excel button by using VBA macro.

I managed to achieved that through this tutorial "How to Call BPC Data Manager Package from Visual Basic", which is very helpful.

However, I realized I will need to execute the script logic, which contains BADI as well.

Therefore, is there a code which I can include into the existing macro provided by the tutorial that will trigger the script logic file too?

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

1 Answer

Vadim Kalinin Nov 22, 2017 at 07:37 AM
1

But what is the issue? You create dm package with default_formulas chain to run script logic. Then you run this package using VBA.

I recommend my blog https://blogs.sap.com/2017/06/16/simple-vba-function-to-pass-parameters-to-dm-packages/

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

Hi Vadim,

Thanks for your response.

My BPC have several data manager packages that requires user to run for copying data from one dimension to another and because the copy is not as straight-forward as copying from 1 dimension to 1 dimension, it requires BADI to handle it.

In summary, it work like this,

User --> Data Manager --> Script Logic --> BADI

So, my DM packages handled it well. However, users are complaining that the DM process is too technical for them (they have to select from which dimension to copy to which dimension and etc), so I'm looking for alternative to improve this process and I came across the solution PDF which I mentioned earlier. This solution fits my requirement very well but it doesn't cater for calling the script logic which will eventually execute the BADI.

Now I'm hoping it can work like this,

User --> Excel (via macro) --> Data Manager (background) --> Script Logic --> BADI

0

Have to repeat - there is no difference for VBA to run any dm package: with script logic or without it. VBA has to pass parameters to dm package. Please look on my VBA code in the blog referenced in my previous answer - very easy to implement.

Can you post an advanced script of dm package to run you script logic with badi?

0
Former Member

Hi Vadim,

Do you mean to say that I can just use the default VB provided in this tutorial,

"How to Call BPC Data Manager Package from Visual Basic" and it will still run my script logic?

Below is a sample of my script logic,

===========================================================

PROMPT(SELECTINPUT,,,,"%ENTITY_DIM%,%TIME_DIM%,ProfitCenter")
TASK(/CPMB/RUNCALCACCOUNT_LOGIC,SUSER,%USER%)
TASK(/CPMB/RUNCALCACCOUNT_LOGIC,SAPPSET,%APPSET%)
TASK(/CPMB/RUNCALCACCOUNT_LOGIC,SAPP,%APP%)
TASK(/CPMB/RUNCALCACCOUNT_LOGIC,SELECTION,%SELECTION%)
TASK(/CPMB/RUNCALCACCOUNT_LOGIC,LOGICFILENAME,SALESVOL_OPUTVOL_ORI.LGF)

===========================================================

As you can see, at the end of the DM script, it calls upon this script logic file "SALESVOL_OUTPUTVOL_ORI.LGF.

I just want to make sure my VB will also calls upon this script logic file after passing parameters from the DM package.

0

"Below is a sample of my script logic" - sorry, it's not a script logic, it's an advanced dm package script.

Instead of "How to Call BPC Data Manager Package from Visual Basic use my code in the blog".

Sample code:

Dim strAnsw() As String

' Sample to run script    
    ReDim strAnsw(0 To 0)
    strAnsw(0) = "%SELECTION%P|DIMENSION:ENTITY|XXXXXXX|DIMENSION:TIME|XXXXXX|DIMENSION:ProfitCenter|XXXXXX"
    ExeceuteDM strAnsw, "", "Data Management", "PackageName", "/CPMB/RUNCALCACCOUNT", "0001"
0
Former Member

Hi Vadim,

Sorry, typo, yeah its advance dm package script.

I've tried your VBA script, it gives me error "Sub or Function not defined" for the "ExeceuteDM" function.

Is it Execute or Execeute?

Below are my script now.

=================

Public Sub TestRunDM()

Dim strAnsw() As String

ReDim strAnsw(0 To 0)
strAnsw(0) = "%SELECTION%P|DIMENSION:ENTITY|MY40|DIMENSION:TIME|2013.JUN|DIMENSION:ProfitCenter|MY4010"
ExeceuteDM strAnsw, "", "Data Management", "SALES2OUTPUT_QTY", "/CPMB/RUNCALCACCOUNT", "0001"

End Sub

=================

0

Sorry, but looks like you didn't read my blog. You have to copy the code of the function ExeceuteDM

0