Skip to Content
0
Jun 19, 2011 at 08:36 AM

BAPI Help Required with GETSTATUS

38 Views

I have been extensively using SAP GUI Scripting for many years now. I am looking to replace this functionality with BAPI functions to improve the user feel of the interfaces I develop.

I have hit a bit of a problem and after extensive searching I have been unable to find a working example. I can connect, I can read the data retrieved within most key fields and attributes. The example I have been using is the Functional Location BAPI. I will need to read the system and user status's of this object. I have successfully used Dimas to call GetStatus but I believe DImas is used more for passing data to SAP and not retrieving.

Whether using DImas or getting the floc object to call getStatus I am still left with the question. How can I retrieve the data.

My Code below is only a test code to see how this all works.

Dim floc As Object

Dim Sstatus, Ustatus, oReturn, statusVals, sys, col, row As Object

Dim somthing As String

Dim obctrl As New SAPBAPIControlLib.SAPBAPIControl

obctrl.Connection.System = "Sys"

obctrl.Connection.Client = "400"

obctrl.Connection.User = "user"

obctrl.Connection.Password = "pwd"

obctrl.Connection.Language = "EN"

'obctrl.Connection = logCtrl.NewConnection

obctrl.Connection.Logon(0, True)

On Error GoTo errorhandler

Err.Clear()

floc = obctrl.GetSAPObject("FunctionalLocation", "3001-320-2553")

Sstatus = obctrl.DimAs(floc, "GetStatus", "SystemStatus")

statusVals = obctrl.DimAs(floc, "GetStatus", "Return")

Ustatus = obctrl.DimAs(floc, "GetStatus", "UserStatus")

floc.GetStatus(SystemStatus:=Sstatus, UserStatus:=Ustatus, Return:=oReturn)

Any assisstance with this and the use/purpose of dimas would be helpful.

Regards