‎2007 Jan 10 8:12 PM
I am currently developing an Excel tool that calls BAPI_USER_GET_DETAIL to determine the user's firstname and lastname from the Export structure ADDRESS (BAPIADDR3). I am having trouble in how I should declare a variable to contain the contents of this structure and how to access the FIRSTNAME and LASTNAME fields of the structure. It seems that when I try to access ADDRESS as a string it returns a value of "Error 0". Any help here would help.
Thanks,
John
‎2007 Jan 10 8:30 PM
Hi,
I assume tha you are using Visual Basic...
You can find small example below. Generally structures similar to tables are managed as objects so you should define it as Object... In example I used PartnerList variable to get fields values of returned table.
Dim MyFunc, PartnerList, Row As Object
Dim Result As Boolean
Set MyFunc = Funct.Add("BAPI_FUNCTION_NAME")
Set PartnerList = MyFunc.Tables("PARTNER_LIST")
Result = MyFunc.Call
If Result = True Then
Set PartnerList = MyFunc.Tables("PARTNER_LIST")
For Each Row In PartnerList.Rows
Text = Row("PARTNER_NO") + " " + Row("BPTYPE") + " " + Row("NAME1")
MsgBox Text
Next Row
Else
MsgBox MyFunc.Exception
Funct.Connection.Logoff
End If
regards
Krzys
‎2007 Jan 10 8:30 PM
Hi,
I assume tha you are using Visual Basic...
You can find small example below. Generally structures similar to tables are managed as objects so you should define it as Object... In example I used PartnerList variable to get fields values of returned table.
Dim MyFunc, PartnerList, Row As Object
Dim Result As Boolean
Set MyFunc = Funct.Add("BAPI_FUNCTION_NAME")
Set PartnerList = MyFunc.Tables("PARTNER_LIST")
Result = MyFunc.Call
If Result = True Then
Set PartnerList = MyFunc.Tables("PARTNER_LIST")
For Each Row In PartnerList.Rows
Text = Row("PARTNER_NO") + " " + Row("BPTYPE") + " " + Row("NAME1")
MsgBox Text
Next Row
Else
MsgBox MyFunc.Exception
Funct.Connection.Logoff
End If
regards
Krzys
‎2007 Jan 10 9:25 PM
I figured it out....seems I was doing it right all along, just didn't have the right VB to print the fields that I wanted form ADDRESS.
Thanks for the reply, it helped me see my VB mistake.
Regards,
John
‎2007 Sep 07 11:30 AM
Hello John,
I am currently developing a Leave Application in VB that calls BAPI_USER_GET_DETAIL. I am facing same problem as u faced it earlier, to determine the user's FullName from the Export structure ADDRESS (BAPIADDR3). I am having trouble in how I should declare a variable to contain the contents of this structure and how to access the FullName fields of the structure. I hope that u overcame this problem.if so please give some details code
Thanks in advance,
Minaxi Shah