If you have created your own SAP function module, you can use this with the following VBA code.
Sub FunctionModule()
'Variables Definition
Dim MyFunc As Object
Dim E_INSERTED As Object
Dim E_MODIFIED As Object
Dim DATA As Object
Set MyFunc = R3.Add("Z_RSDRI_UPDATE_LCP") 'FunctionModule Name in SAP BW
Set E_INSERTED = MyFunc.imports("E_INSERTED") 'InsertFunction in SAP BW
Set E_MODIFIED = MyFunc.imports("E_MODIFIED") 'ModifyFunction in SAP BW
Set DATA = MyFunc.tables("I_T_DATA") 'Table to store data and write to BW.
'Add data
DATA.Rows.Add 'add new data
rowDATA.Value(1, 1) = Sheet1.Cells(1, 10).Value 'First Cell of the data table is filled with the value from Sheet1.Cells(1,10)
'Call Insert or Modify
Result = MyFunc.CALL
'Message to the User
If Result = True Then
MsgBox "Insert Rows: " & E_INSERTED.Value & " Modify Rows: " & E_MODIFIED.Value, vbInformation
Else
MsgBox MyFunc.EXCEPTION 'Exception
End If
End Sub
These posts might also be interesting:
author.
I am Tobias, I write this blog since 2014, you can find me on twitter and youtube. If you want you can leave me a paypal coffee donation. You can also contact me directly if you want.
You want to know SAP Analysis Office in a perfect detail?
You want to know how to build an Excel Dashboard with your Query in Analysis Office?
You want to know how functions in SAP Analysis Office works?
Then you have to take a look into Analysis Office - The Comprehensive Guide.
Write a comment