Skip to Content
Author's profile photo Sascha Mink

HowTo Call an ABAP Function Module out of the BEx Analyzer

Sometimes it would be nice if we could call an abap function module right out of the BEx Analyzer. For example in an integrated planning environment for enriching data or something like this …

Fortunately this is possible with only a little effort in Visual Basic for Applications. You can take a look at this SAP Help Page.

There is a nice tutorial for this.

VBA Snippet:

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


Dim FunctionCtrl As Object
Dim func
' first we have to create an function module object
Set FunctionCtrl = CreateObject("SAP.Functions")
' now we fetch the bex connection
Dim bexCon As Object
Set bexCon = Application.Run("BExAnalyzer.xla!sapBEXgetConnection")
' setting the bex connection for our function module
FunctionCtrl.Connection = bexCon ' doing it this way let us do the call to the function module
                                                ' without embarassing the user with logon-dialogs, etc.
                                                               ' this is the real "feature" of this document
' calling the function module
Set func = FunctionCtrl.Add("....")     ' place the name of your abap function module here
With func
    .Exports("") = ...                                ' set the import values of the abap function module (for example to a value of an excel cell)
    ...
End With  
result = func.call()                               ' call the function module
x = func.imports("...")                          ' the export value of the abap function module is now in x, you can set for example the value of a cell to the content of x

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

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.