Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reading Customers from SAP into Access

Status
Not open for further replies.

hackei

Programmer
May 2, 2005
1
0
0
DE
Hi all,

I want to read the Customers stored in SAP. The BAPI-Method i want to use is "BAPI_CUSTOMER_GETLIST". The Problem is, that i have to give (Table)Data to the BAPI to start him correctly. This is the Table "IDRANGE".
Please help me with an example or useful tips
 
Hi,

IDRANGE sets the criterias to specifiy which data should be returned (similar to the WHERE-statement in SQL).

SIGN = "I" or "E" (include or exclude records)
OPTION = "CP" (compare) or "EQ" (equal) or "BT" (below than)
LOW = "*" (for all) or a customer ID number to start with
HIGH = leave empty or specify a "highest" customer ID


Here's some VB sample code to retrieve all customer names/IDs:

Public Function GetCustomers() As Boolean

Dim sapBOCustomer As Object
Dim idRng As Object
Dim tbAdressdata As Object
Dim tbRow As Object
Dim bapiRet1 As Object

Set sapBOCustomer = FMain.BAPICtl.GetSAPObject("Customer")

Set idRng = FMain.BAPICtl.DimAs(sapBOCustomer, "Getlist", "IDRANGE")

idRng.Columns("SIGN").Data = "I"
idRng.Columns("OPTION").Data = "CP"
idRng.Columns("LOW").Data = "*"

sapBOCustomer.GetList idRange:=idRng, Addressdata:=tbAdressdata,
return:=bapiRet1

For Each tbRow In tbAdressdata.Rows
.AddNew
debug.print tbRow.Value("Name")
debug.print = tbRow.Value("Customer")
Next tbRow

Set tbRow = Nothing
Set tbAdressdata = Nothing
Set idRng = Nothing
Set bapiRet1 = Nothing
Set sapBOCustomer = Nothing

End Function
 
Sorry, a small correction: Please remove the line " .AddNew" from the code (I forgot to delete it as I derived the sample code from a more complex routine).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top