<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to retrieve the data from SAP-BAPI by using VB Code in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-retrieve-the-data-from-sap-bapi-by-using-vb-code/m-p/1782582#M337213</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Using ur code as a sample i find out the solution to retrieve the data from SAP through RFC Concept (as per ur example). But its working only for retrieving the single record.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I doesn't know how to retrieve the multiple records. Could u guide me in this aspect?....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in Advance.....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 29 Dec 2006 11:23:12 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-12-29T11:23:12Z</dc:date>
    <item>
      <title>How to retrieve the data from SAP-BAPI by using VB Code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-retrieve-the-data-from-sap-bapi-by-using-vb-code/m-p/1782580#M337211</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;I am new to BAPI. &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;V have created an application in Visual Basic with the following fields&lt;/P&gt;&lt;P&gt;EmpNo , EmpName, Addr1, Addr2, City and Phone (Only for Test)&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;We have written the code for SAVING the data into SAP. Already we have &lt;/P&gt;&lt;P&gt;constructed a table with the respective fields in SAP.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;For that we ourself created our own BAPI Structure / Function Group / &lt;/P&gt;&lt;P&gt;Function Module/ Business Object - RELEASED related elements.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;1)Established the connection successfully.&lt;/P&gt;&lt;P&gt;2)Stored the data into SAP Successfully and v r in need of&lt;/P&gt;&lt;P&gt;3)HOW TO RETRIEVE THE DATA FROM SAP (USING GETLIST.....GETDETAIL....)&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;Following is the code :&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;'BAPI Structure  : ZBAPIEMP&lt;/P&gt;&lt;P&gt;'Function Group  : ZBAPIEMP&lt;/P&gt;&lt;P&gt;'Function Module : ZBAPI_EMP_CREATEFROMDATA&lt;/P&gt;&lt;P&gt;'Business Object : ZBAPIEMP&lt;/P&gt;&lt;P&gt;'Function Module : ZBAPI_EMP_GETLIST&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;Dim bapictrl As Object&lt;/P&gt;&lt;P&gt;Dim oconnection As Object&lt;/P&gt;&lt;P&gt;Dim boEmp As Object&lt;/P&gt;&lt;P&gt;Dim oZEmp_Header As Object&lt;/P&gt;&lt;P&gt;Dim oImpStruct As Object&lt;/P&gt;&lt;P&gt;Dim oExpStruct As Object&lt;/P&gt;&lt;P&gt;Dim oreturn As Object&lt;/P&gt;&lt;P&gt;Dim x As String&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;Private Sub Form_Load()&lt;/P&gt;&lt;P&gt;Set bapictrl = CreateObject("SAP.BAPI.1")&lt;/P&gt;&lt;P&gt;Set oconnection = bapictrl.Connection&lt;/P&gt;&lt;P&gt;oconnection.logon&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;Set boEmp = bapictrl.GetSAPObject("ZBAPIEMP")&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;Set oZEmp_Header = bapictrl.DimAs(boEmp, "CreateFromData", "EmployeeHeader")&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;Set oImpStruct = bapictrl.DimAs(boEmp, "GetList", "EmployeeDispStruct")&lt;/P&gt;&lt;P&gt;End Sub&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;Private Sub cmdSave_Click()&lt;/P&gt;&lt;P&gt;    oZEmp_Header.Value("EMPNO") = txtEmpNo.Text&lt;/P&gt;&lt;P&gt;    oZEmp_Header.Value("EMPNAME") = txtEmpName.Text&lt;/P&gt;&lt;P&gt;    oZEmp_Header.Value("ADDR1") = txtAddr1.Text&lt;/P&gt;&lt;P&gt;    oZEmp_Header.Value("ADDR2") = txtAddr2.Text&lt;/P&gt;&lt;P&gt;    oZEmp_Header.Value("CITY") = txtCity.Text&lt;/P&gt;&lt;P&gt;    oZEmp_Header.Value("PHONE") = txtPhone.Text&lt;/P&gt;&lt;P&gt;    &lt;/P&gt;&lt;P&gt;    boEmp.CreateFromData EmployeeHeader:=oZEmp_Header, Return:=oreturn&lt;/P&gt;&lt;P&gt;   &lt;/P&gt;&lt;P&gt;    x = oreturn.Value("Message")&lt;/P&gt;&lt;P&gt;    If x = "" Then&lt;/P&gt;&lt;P&gt;        MsgBox "Transaction Completed!..."&lt;/P&gt;&lt;P&gt;    Else&lt;/P&gt;&lt;P&gt;        MsgBox x&lt;/P&gt;&lt;P&gt;    End If&lt;/P&gt;&lt;P&gt;End Sub&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;Private Sub cmdView_Click()&lt;/P&gt;&lt;P&gt;?&lt;/P&gt;&lt;P&gt;?&lt;/P&gt;&lt;P&gt;?&lt;/P&gt;&lt;P&gt;End Sub&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;COULD ANYBODY GUIDE ME, HOW TO RETRIEVE THE DATA FROM BAPI, FOR THE WRITTEN CODE.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Dec 2006 06:20:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-retrieve-the-data-from-sap-bapi-by-using-vb-code/m-p/1782580#M337211</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-12-11T06:20:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to retrieve the data from SAP-BAPI by using VB Code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-retrieve-the-data-from-sap-bapi-by-using-vb-code/m-p/1782581#M337212</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I didn't seen any other answers but here's how it's been done previously in our organization for a custom BAPI. In this example, we give material and language to return the part description. It's not specific to your project but may give you ideas..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Tim&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Option Compare Database&lt;/P&gt;&lt;P&gt;Dim SAPLOGIN As Boolean&lt;/P&gt;&lt;P&gt;Dim FunctionCtrl As Object&lt;/P&gt;&lt;P&gt;Dim SapConnection As Object&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sub SAPLOGOUT()&lt;/P&gt;&lt;P&gt;On Error GoTo LogoutFehler&lt;/P&gt;&lt;P&gt;    SapConnection.logoff&lt;/P&gt;&lt;P&gt;    SAPLOGIN = False&lt;/P&gt;&lt;P&gt;Exit Sub&lt;/P&gt;&lt;P&gt;LogoutFehler:&lt;/P&gt;&lt;P&gt;    If Err.Number = 91 Then&lt;/P&gt;&lt;P&gt;        Exit Sub&lt;/P&gt;&lt;P&gt;    Else&lt;/P&gt;&lt;P&gt;        MsgBox Err.Description, vbCritical, "Fehler-Nr." &amp;amp; CStr(Err.Number) &amp;amp; " bei SAP-Logout"&lt;/P&gt;&lt;P&gt;    End If&lt;/P&gt;&lt;P&gt;End Sub&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Function SAPLOG() As Boolean&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;'Verbindungsobjekt setzen (Property von FunctionCtrl)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;'&lt;/P&gt;&lt;P&gt;   Set FunctionCtrl = CreateObject("SAP.Functions")&lt;/P&gt;&lt;P&gt;   Set SapConnection = FunctionCtrl.Connection&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;'Logon mit Initialwerten&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   SapConnection.Client = "010"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   SapConnection.Language = "EN"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   SapConnection.System = "PR1"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   SapConnection.SystemNumber = "00"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   'SapConnection.Password = ""&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   SapConnection.GroupName = "PR1"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   SapConnection.HostName = "168.9.25.120"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   SapConnection.MessageServer = "168.9.25.120"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;     If SapConnection.Logon(0, False) &amp;lt;&amp;gt; True Then  'Logon mit Dialog&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;         Set SapConnection = Nothing&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;         DoCmd.Hourglass False&lt;/P&gt;&lt;P&gt;         MsgBox "No connection to SAP R/3 !"&lt;/P&gt;&lt;P&gt;         SAPLOGIN = False&lt;/P&gt;&lt;P&gt;         SAPLOG = False&lt;/P&gt;&lt;P&gt;         Exit Function&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      End If&lt;/P&gt;&lt;P&gt;    SAPLOG = True&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;End Function&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Function MatDescr(MatNr As String)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Dim func1 As Object&lt;/P&gt;&lt;P&gt;Dim row As Object, X As Integer, ErsteNr As String&lt;/P&gt;&lt;P&gt;Dim DatensatzZähler As Long&lt;/P&gt;&lt;P&gt;Dim RowField(1 To 50, 0 To 1) As String, RowLine As Long&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    If Not SAPLOGIN Then&lt;/P&gt;&lt;P&gt;        If Not SAPLOG() Then&lt;/P&gt;&lt;P&gt;            MsgBox "No connection  to SAP !", 16&lt;/P&gt;&lt;P&gt;            SAPLOGOUT&lt;/P&gt;&lt;P&gt;            Exit Function&lt;/P&gt;&lt;P&gt;        End If&lt;/P&gt;&lt;P&gt;    End If&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;' Instanziieren des Function-Objektes&lt;/P&gt;&lt;P&gt;Set func1 = FunctionCtrl.Add("Z_BAPI_READ_MAKT")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;' Export-Paramter definieren&lt;/P&gt;&lt;P&gt;func1.exports("MATNR") = MatNr&lt;/P&gt;&lt;P&gt;func1.exports("SPRAS") = "EN"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DoEvents&lt;/P&gt;&lt;P&gt;If Not func1.call Then&lt;/P&gt;&lt;P&gt;    If func1.exception &amp;lt;&amp;gt; "" Then&lt;/P&gt;&lt;P&gt;        MsgBox "Communication Error with RFC " &amp;amp; func1.exception&lt;/P&gt;&lt;P&gt;    End If&lt;/P&gt;&lt;P&gt;    DoCmd.Hourglass False&lt;/P&gt;&lt;P&gt;    SAPLOGOUT&lt;/P&gt;&lt;P&gt;    Exit Function&lt;/P&gt;&lt;P&gt;Else&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  MatDescr = func1.imports("MAKTX")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;End If&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If MatDescr = "" Then&lt;/P&gt;&lt;P&gt;    MatDescr = "PART NO. NOT FOUND"&lt;/P&gt;&lt;P&gt;End If&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;End Function&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Dec 2006 16:08:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-retrieve-the-data-from-sap-bapi-by-using-vb-code/m-p/1782581#M337212</guid>
      <dc:creator>90070279</dc:creator>
      <dc:date>2006-12-14T16:08:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to retrieve the data from SAP-BAPI by using VB Code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-retrieve-the-data-from-sap-bapi-by-using-vb-code/m-p/1782582#M337213</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Using ur code as a sample i find out the solution to retrieve the data from SAP through RFC Concept (as per ur example). But its working only for retrieving the single record.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I doesn't know how to retrieve the multiple records. Could u guide me in this aspect?....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in Advance.....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Dec 2006 11:23:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-retrieve-the-data-from-sap-bapi-by-using-vb-code/m-p/1782582#M337213</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-12-29T11:23:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to retrieve the data from SAP-BAPI by using VB Code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-retrieve-the-data-from-sap-bapi-by-using-vb-code/m-p/1782583#M337214</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Giri,&lt;/P&gt;&lt;P&gt;I am also very new to BAPI, so can u plz. send me the all steps of the same.&lt;/P&gt;&lt;P&gt;How to create BAPI , function module ....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Vikram&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Jul 2007 09:58:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-retrieve-the-data-from-sap-bapi-by-using-vb-code/m-p/1782583#M337214</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-16T09:58:21Z</dc:date>
    </item>
  </channel>
</rss>

