BAPI-VB, Unable to call method GetDetail of USER Object using SAP.BAPI.1

I am trying to call SAP Methods using Excel VBA.
In the below example, I am trying to get the user details.
I can solve this, if I use SAP.Functions object, but not when I use SAP.BAPI.1 object.
The Procedure GetUserDetails() works fine, but the 2nd one GetUserDetails2() fails?
Can you tell what is the difference in calling SAP method with SAP.Functions and SAP.BAPI.1 ?
Also how can I run the program GetDetails2() using SAP.BAPI.1
Const CNT_STR_USR As String = "XXXXX"
Const CNT_STR_PWD As String = "XXXXX"
Const CNT_STR_APPLN_SRVR As String = "ides47"
Const CNT_STR_SYSTEM As String = "IDS"
Const CNT_STR_SYS_NUM As String = "00"
Const CNT_STR_CLIENT As String = "800"
Const CNT_STR_LOGON_LANG As String = "EN"
Const CNT_STR_LOG_FILE As String = "C:sap_vb.txt"
Const CNT_INT_LOG_LEVEL As Integer = 9
'Works Fine
Public Sub GetUserDetails()
'Using SAP Functions
Dim obSAPFn As Object
Dim obFuncUsrDtl As Object
Dim obFuncRtrn As Object
Dim obFuncLogDtl As Object
Dim sRetStatus As String * 1, sErrText As String, sUsrGroup As String * 12
Dim iRetRowCount As Integer, iLoop As Integer
Dim bErrFlag As Boolean
'Set obSAPFn = New SAPFunctions
Set obSAPFn = CreateObject("SAP.Functions")
obSAPFn.Connection.ApplicationServer = CNT_STR_APPLN_SRVR
obSAPFn.Connection.SystemNumber = CNT_STR_SYS_NUM
obSAPFn.Connection.User = CNT_STR_USR
obSAPFn.Connection.Password = CNT_STR_PWD
obSAPFn.Connection.Language = CNT_STR_LOGON_LANG
obSAPFn.Connection.Client = CNT_STR_CLIENT
'Check For Connection
If obSAPFn.Connection.Logon(0, True) = False Then
    MsgBox "R/3 connection failed"
Exit Sub
    If obSAPFn.Connection.IsConnected Then
'    MsgBox "Connected"
    MsgBox "Not COnnected"
    Exit Sub
    End If
End If
'Get User Details.
Set obFuncUsrDtl = obSAPFn.Add("BAPI_USER_GET_DETAIL")
obFuncUsrDtl.Exports("USERNAME") = CNT_STR_USR
Set obFuncRtrn = obFuncUsrDtl.Tables("RETURN")
iRetRowCount = obFuncRtrn.RowCount
bErrFlag = False
For iLoop = 1 To iRetRowCount
    If obFuncRtrn(iLoop, "TYPE") = "E" Then
'        ErrorUsuario = True
        sErrText = "E" & obFuncRtrn(iLoop, "ID") & obFuncRtrn(iLoop, "NUMBER") & _
                     " " & obFuncRtrn(iLoop, "MESSAGE")
        MsgBox sErrText
        bErrFlag = True
        Exit For
    End If
If bErrFlag = False Then
Set obFuncLogDtl = obFuncUsrDtl.Imports("LOGONDATA")
sUsrGroup = obFuncLogDtl("CLASS")
MsgBox sUsrGroup
End If
Set obFuncRtrn = Nothing
Set obFuncLogDtl = Nothing
Set obFuncUsrDtl = Nothing
Set obSAPFn = Nothing
End Sub
' Does not work
Public Sub GetUserDetails2()
'Using BAPI Object
Dim obSapBAPICtrl As Object 'BAPI control object
'Dim obSAPConn As Object 'Connection object
Dim obSAPUSER As Object ' To Get Details of USER Object
Dim obLogondata As Object, obDefaults As Object, obAddress As Object, obCompany As Object
Dim obSnc As Object, obParameter As Object, obProfiles As Object, obActivitygroups As Object
Dim obReturn As Object, obAddComrem As Object, obAddRml As Object, obAddPag As Object
Dim obAddUri As Object, obAddSsf As Object, obAddPrt As Object, obAddRfc As Object
Dim obAddX400 As Object, obAddSmtp As Object, obAddTlx As Object, obAddTtx As Object
Dim obAddTel As Object, obAddFax As Object, obParameter1 As Object
Dim sRetStatus As String * 1, sTransId As String, sUsrGroup As String
Dim iRetRowCount As Integer, iLoop As Integer
Set obSapBAPICtrl = CreateObject("SAP.BAPI.1")
obSapBAPICtrl.Connection.ApplicationServer = CNT_STR_APPLN_SRVR
obSapBAPICtrl.Connection.SystemNumber = CNT_STR_SYS_NUM
obSapBAPICtrl.Connection.User = CNT_STR_USR
obSapBAPICtrl.Connection.Password = CNT_STR_PWD
obSapBAPICtrl.Connection.Language = CNT_STR_LOGON_LANG
obSapBAPICtrl.Connection.Client = CNT_STR_CLIENT
obSapBAPICtrl.LogFileName = CNT_STR_LOG_FILE
'Don't show the logon details
'Connect to SAP
If obSapBAPICtrl.Connection.Logon(0, True) = False Then
    MsgBox "R/3 connection failed"
    Exit Sub
    If obSapBAPICtrl.Connection.IsConnected Then
'    MsgBox "Connected"
    MsgBox "Not COnnected"
    Exit Sub
    End If
End If
‘Could not find a way to pass the User Id?
‘ Is this the right way to pass the user Id for this Object?
Set obLogondata = obSapBAPICtrl.DimAs(obSAPUSER, "GetDetail", "Logondata")
Set obDefaults = obSapBAPICtrl.DimAs(obSAPUSER, "GetDetail", "Defaults")
Set obAddress = obSapBAPICtrl.DimAs(obSAPUSER, "GetDetail", "Address")
Set obCompany = obSapBAPICtrl.DimAs(obSAPUSER, "GetDetail", "Company")
Set obSnc = obSapBAPICtrl.DimAs(obSAPUSER, "GetDetail", "Snc")
Set obParameter = obSapBAPICtrl.DimAs(obSAPUSER, "GetDetail", "Parameter")
Set obProfiles = obSapBAPICtrl.DimAs(obSAPUSER, "GetDetail", "Profiles")
Set obActivitygroups = obSapBAPICtrl.DimAs(obSAPUSER, "GetDetail", "Activitygroups")
Set obReturn = obSapBAPICtrl.DimAs(obSAPUSER, "GetDetail", "Return")
Set obAddComrem = obSapBAPICtrl.DimAs(obSAPUSER, "GetDetail", "AddComrem")
Set obAddRml = obSapBAPICtrl.DimAs(obSAPUSER, "GetDetail", "AddRml")
Set obAddPag = obSapBAPICtrl.DimAs(obSAPUSER, "GetDetail", "AddPag")
Set obAddUri = obSapBAPICtrl.DimAs(obSAPUSER, "GetDetail", "AddUri")
Set obAddSsf = obSapBAPICtrl.DimAs(obSAPUSER, "GetDetail", "AddSsf")
Set obAddPrt = obSapBAPICtrl.DimAs(obSAPUSER, "GetDetail", "AddPrt")
Set obAddRfc = obSapBAPICtrl.DimAs(obSAPUSER, "GetDetail", "AddRfc")
Set obAddX400 = obSapBAPICtrl.DimAs(obSAPUSER, "GetDetail", "AddX400")
Set obAddSmtp = obSapBAPICtrl.DimAs(obSAPUSER, "GetDetail", "AddSmtp")
Set obAddTlx = obSapBAPICtrl.DimAs(obSAPUSER, "GetDetail", "AddTlx")
Set obAddTtx = obSapBAPICtrl.DimAs(obSAPUSER, "GetDetail", "AddTtx")
Set obAddTel = obSapBAPICtrl.DimAs(obSAPUSER, "GetDetail", "AddTel")
Set obAddFax = obSapBAPICtrl.DimAs(obSAPUSER, "GetDetail", "AddFax")
Set obParameter1 = obSapBAPICtrl.DimAs(obSAPUSER, "GetDetail", "Parameter1")
sTransId = obSapBAPICtrl.CreateTransactionID()
'obSapBAPICtrl.TransactionId = sTransId
obSAPUSER.GetDetail Logondata:=obLogondata, Defaults:=obDefaults, Address:=obAddress, _
Company:=obCompany, Snc:=obSnc, Parameter:=obParameter, Profiles:=obProfiles, _
Activitygroups:=obActivitygroups, Return:=obReturn, AddComrem:=obAddComrem, _
AddRml:=obAddRml, AddPag:=obAddPag, AddUri:=obAddUri, AddSsf:=obAddSsf, _
AddPrt:=obAddPrt, AddRfc:=obAddRfc, AddX400:=obAddX400, AddSmtp:=obAddSmtp, _
AddTlx:=obAddTlx, AddTtx:=obAddTtx, AddTel:=obAddTel, AddFax:=obAddFax, _
iRetRowCount = obReturn.RowCount
If iRetRowCount > 0 Then
    For iLoop = 0 To iRetRowCount
        sRetStatus = obReturn(iLoop, "TYPE")
        If sRetStatus = "S" Then
        sUsrGroup = obLogondata("CLASS")
        MsgBox sUsrGroup
        End If
End If
Set obSAPUSER = Nothing
'Set obSAPConn = Nothing
Set obSapBAPICtrl = Nothing
End Sub


The problem was occuring because, the structure Return was not holding any values.
But the other tables which returned values were getting populated.

Direct methods access of interfaced object

Hi, gurus! My situation like this: Code: public interface IHost {     function doSomething() : void; Code: import IHost; public class Host implements IHost {     public function doSomething() : void { trace("doSomething"); }  

Creating a business object using bapi

can some one tell me how to create a business object using a bapi and is it possible to create bapi using business object.which is dependent on which one.> jayashankar wrote: > can some one tell me how to create a business object using a bapi and is

Unable to create PO with multiple line items through LSMW-BAPI method

Hi All, I have a requirement of creating PO through LSMW. I can't use LSMW standard batch input program since there are some fileds not available and also it has many limitations. I'm using LSMW-BAPI method ( Business object BUS2012) which create IDO

Syntax for how to call method of one comp in other comp     wd java.

Let us assume, there is method1 in view1 comp1. tell me syntax for calling method 1 in view2 comp2 thanks in advance. Edited by: madhu1011 on Nov 9, 2011 11:31 AMHi Madhu, This is the situation: comp1-> method 1 , view1 comp2-> view2 You need to acc

About call method

hi, i want to open a new window when i presses the button, so , should the new window also be a class or just a component.en, hehe,firstly, i am rookie in Java, i dont know lots about it. what i want to do is : if else(e.getSource()=j1){ display(); }

About calling method with arguments

Hi, I have a problem about calling method using reflection. my method is like follows: public myMethod(Integer var1, MyObject mobj) { I've tried to call the method using the following code, Class[] parameterTypes = new Class[] {Integer.class, MyObjec


Hi, i am testing fault message(inbound server abap proxy - sync), but i do not know what do i set class name on  exception_class_name on CALL METHOD CL_PROXY_FAULT=>raise. data : uname         type ZXIUSER_NAME_DT_DATA1-name. data : f1            typ

CALL METHOD ob_grid1- set_table_for_first_display does not change display

Dear experts, I'm using CALL METHOD ob_grid1->set_table_for_first_display, during the first run the display is ok. When I back to screen 0 and enter different values and re-run, the values of internal table has been changed. But the second run still

FRF-00025  Unable to call function. Error message: Syntax error in program

hi, when we try to import the export file,we are getting the following error in the 24th phase i.e., check DDIC Password. The Error is INFO       2007-10-29 15:53:20 [iaxxrfcimp.cpp:1017]            CAbRfcImpl::callLibraryFunction Generating interfac

How to call methods from .mxml file from actionscript file

I have a and a Test.mxml. In this Test.mxml, I have a function which is something like: public function doTest():void"testing!"); How do I from call this function doTest() from Test.mxml? I tried declaring

Can we use call method or call action in dynpro.

hi all, In the view of a web-dynpro, can we call one action inside another action..? or can we call a method inside an action.. if so plz help... thanks in advance, jithin.Hi Jithin, Suggest you that, you keep your logic in a method which you are usi

What is a "blocking call" method?

Hello, I'm new to java. In a tuturial I was reading a method was described as a "blocking call" method. Could any one explain to me this concept. Thank you, Jorge Edited by: Jorgejch on Jan 27, 2008 6:11 PMA blocking call is a method in an I/O s

Calling parent method from within child object

Hello, A quick question! Is it possible to call a method in a parent object from within a child object.By child object I mean an object that was instantiated within the parent object. Thanks.A quick question! Is it possible to call a method in a pare

Is it possible to call methods of JAVA objects from ABAP?

Hi all, Does anyone know if it is possible to call methods of java classes from ABAP? Regards, SukruHi, Yes we can access the classes of JAVA in ABP. This is posible from version ECC 6 onward with NETWEAVER atrhcitecuture. Pls go through this link- h

How to call methode on remot computer

I have 2 Applcations on 2 computers in Network App 1 on PC1 send xml file to App2 on PC2 how to call Methods in App2 on PC2 to read the file // clss A on PC1 class A sendFile(){ // clss B on PC2 class A readFile(){ how to cal method readFile from Cla

Unable to call from my skype out account

Hi!         Iam unable to call from my skype out account to india, but i can able to call skype to skype users.pls advice.otherwise pls advice how to cancel the membership and get my money back. Regards RajanContact your carrier.Read other 2 answers

Can I Call method on one JVM from another through a dll?

Let me explain. I have this java jar file that I can only have one instance of running at any given time. I'm using a shared data segment in a dll to store a bool indicating whether the program is already running or not. If it's already running, I ha

MuseJSAssert: ... TypeError: Cannot call method 'getElementsByTagName' of null

This is the error that I get when I open our site. MuseJSAssert: Error calling selector function:TypeError: Cannot call method 'getElementsByTagName' of null Can someone take a look at this? I tried uploading from scratch on to a new bc test site: ex

Unable to call OUI

Hi, Details OS: Windows I alredy installed oracle s/w and database also. Due to some nwk issue i've done system restore. Now i am unable to see Oracle10 in Windows start button. I thought it has gone and i am trying to install again but i am unable t