Skip to Content
author's profile photo Former Member
Former Member


I am new in BAPI. I want to display my Vendor details.

Set sapsupplier = oBAPICtrl.GetSAPObject("Vendor")

Set sapsupplierdata = oBAPICtrl.DimAs(sapsupplier, "GetDetail", "GeneralDetail")

sapsupplier.GetDetail GeneralDetail:=sapsupplierdata, Return:=oreturn

For Each Col In sapsupplierdata.Columns

SAPTableView1.Columns(Col.Index).Name = Col.Name

SAPTableView1.Columns(Col.Index).Protection = True

Next Col

This one is my code. But while running the pgm it is showing error. Can anyone help me to comeout this issue. Thanks in advance.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Oct 01, 2008 at 03:37 PM

    use the below bapi to get vendor details



    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      I am able to find and get vendor no by searching Name.

      Can you help me with BAPI function ... i want to find vendor by Vendor no and get Name,Address etc.

      Sub BAPIFindVendor()
      Dim oBook As Workbook
      Dim oSheet As Worksheet
      Dim oBAPICtrl As Object
      Dim oBAPILogon As Object
      Dim oSalesOrder As Object
      Dim oItem As Object
      Dim iIndex As Integer
      Set oBook = Application.ActiveWorkbook
      Set oSheet = oBook.Worksheets(1)
      ' Initialize SAP ActiveX Control.
      Set oBAPICtrl = CreateObject("sap.bapi.1")
      ' Initialize SAP ActiveX Logon.
      Set oBAPILogon = CreateObject("sap.logoncontrol.1")
      ' Initialize the connection object.
      Set oBAPICtrl.Connection = oBAPILogon.newconnection
      ' Logon with prompt.
      oBAPICtrl.Connection.System = "XYZ"
      oBAPICtrl.Connection.Client = 500


      Set oBapiService = oBAPICtrl.GetSAPObject("BapiService")
      Set bo1 = oBAPICtrl.GetSAPObject("Vendor")
      Set oVendor = oBAPICtrl.DimAs(bo1, "Find", "SELOPTTAB")
      Set oResult = oBAPICtrl.DimAs(bo1, "Find", "RESULTTAB")

      oVendor.Cell(1, "TABNAME") = "LFA1"
      oVendor.Cell(1, "FIELDNAME") = '"NAME1"
      oVendor.Cell(1, "FIELDVALUE") = '"CSI SPORTS TRADING LTD"

      'BAPI Function call
      bo1.Find SELOPTTAB:=oVendor, RESULTTAB:=oResult, Return:=oReturn

      'Check Result
      If oResult(1, "TYPE") = "S" Then
      MsgBox oResult(1, "VENDOR_NO")
      n = oResult.RowCount
      For i = 1 To n
      MsgBox oResult(i, "MESSAGE")
      Next i
      End If
      ' Logoff SAP and close the control.
      Set oBAPILogon = Nothing
      Set oBAPICtrl = Nothing
      End Sub

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.