<?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: Active X bapi commit in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/active-x-bapi-commit/m-p/3167384#M753537</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Gareth,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you have some sample code showing how you call the commit proceedure from Java.   I should be able to translate this into VB or C#.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If possible I would like to keep all my code in one place.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;John.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 20 Dec 2007 09:52:51 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-12-20T09:52:51Z</dc:date>
    <item>
      <title>Active X bapi commit</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/active-x-bapi-commit/m-p/3167380#M753533</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have created to short vb.net program to test the goods movement bapi.   The code returns a material document and a year but this does not exist in SAP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do I need a commit or have I made a different error?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;John.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;my code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Imports SAPBAPIControlLib&lt;/P&gt;&lt;P&gt;Imports SAPTableFactoryCtrl&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Module Module1&lt;/P&gt;&lt;P&gt;    Dim oGoodsmvtHeader As Object&lt;/P&gt;&lt;P&gt;    Dim oGoodsmvt As Object&lt;/P&gt;&lt;P&gt;    Dim oGoodsmvtCode As Object&lt;/P&gt;&lt;P&gt;    Dim oGoodsmvtItem As Object&lt;/P&gt;&lt;P&gt;    Dim oGoodsmvtSerialnumber As Object&lt;/P&gt;&lt;P&gt;    Dim oTestrun As Object&lt;/P&gt;&lt;P&gt;    Dim oGoodsmvtHeadret As Object&lt;/P&gt;&lt;P&gt;    Dim oReturn As Object&lt;/P&gt;&lt;P&gt;    Dim oBAPICtrl As Object&lt;/P&gt;&lt;P&gt;    Dim boMove As Object&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    Sub Main()&lt;/P&gt;&lt;P&gt;        Call axm()&lt;/P&gt;&lt;P&gt;    End Sub&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    Sub axm()&lt;/P&gt;&lt;P&gt;        Dim oBAPICtrl As Object&lt;/P&gt;&lt;P&gt;        Dim oLogonCtrl As Object&lt;/P&gt;&lt;P&gt;        Dim strTID As String&lt;/P&gt;&lt;P&gt;        Console.WriteLine("Create Objects")&lt;/P&gt;&lt;P&gt;        oBAPICtrl = CreateObject("SAP.BAPI.1")&lt;/P&gt;&lt;P&gt;        oLogonCtrl = CreateObject("SAP.Logoncontrol.1")&lt;/P&gt;&lt;P&gt;        oBAPICtrl.Connection = oLogonCtrl.NewConnection&lt;/P&gt;&lt;P&gt;        Console.WriteLine("open logon screen")&lt;/P&gt;&lt;P&gt;        If oBAPICtrl.Connection.Logon() = False Then&lt;/P&gt;&lt;P&gt;            MsgBox("R/3 Connection failed")&lt;/P&gt;&lt;P&gt;            End&lt;/P&gt;&lt;P&gt;        End If&lt;/P&gt;&lt;P&gt;        Console.WriteLine("connected")&lt;/P&gt;&lt;P&gt;        oGoodsmvt = oBAPICtrl.GetSAPObject("GoodsMovement")&lt;/P&gt;&lt;P&gt;        oGoodsmvtHeader = oBAPICtrl.DimAs(oGoodsmvt, "CreateFromData", "GoodsmvtHeader")&lt;/P&gt;&lt;P&gt;        oGoodsmvtCode = oBAPICtrl.DimAs(oGoodsmvt, "CreateFromData", "GoodsmvtCode")&lt;/P&gt;&lt;P&gt;        oGoodsmvtItem = oBAPICtrl.DimAs(oGoodsmvt, "CreateFromData", "GoodsmvtItem")&lt;/P&gt;&lt;P&gt;        oGoodsmvtSerialnumber = oBAPICtrl.DimAs(oGoodsmvt, "CreateFromData", "GoodsmvtSerialnumber")&lt;/P&gt;&lt;P&gt;        oReturn = oBAPICtrl.DimAs(oGoodsmvt, "CreateFromData", "Return")&lt;/P&gt;&lt;P&gt;        oGoodsmvtHeadret = oBAPICtrl.DimAs(oGoodsmvt, "CreateFromData", "GoodsmvtHeadret")&lt;/P&gt;&lt;P&gt;        oReturn = oBAPICtrl.DimAs(oGoodsmvt, "CreateFromData", "Return")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        Console.WriteLine("Objects defined")&lt;/P&gt;&lt;P&gt;        oGoodsmvtHeader.Value("PSTNG_DATE") = "20071218"&lt;/P&gt;&lt;P&gt;        oGoodsmvtHeader.Value("DOC_DATE") = "20071218"&lt;/P&gt;&lt;P&gt;        oGoodsmvtHeader.Value("PR_UNAME") = "FNGJ"&lt;/P&gt;&lt;P&gt;        oGoodsmvtHeader.Value("HEADER_TXT") = "BAPI test"&lt;/P&gt;&lt;P&gt;        oGoodsmvtCode.Value("GM_CODE") = "04"&lt;/P&gt;&lt;P&gt;        oGoodsmvtItem.Rows.Add()&lt;/P&gt;&lt;P&gt;        oGoodsmvtItem.Value(1, "MATERIAL") = "ZE0512-550"&lt;/P&gt;&lt;P&gt;        oGoodsmvtItem.Value(1, "PLANT") = "1111"&lt;/P&gt;&lt;P&gt;        oGoodsmvtItem.Value(1, "STGE_LOC") = "0000"&lt;/P&gt;&lt;P&gt;        oGoodsmvtItem.Value(1, "MOVE_TYPE") = "301"&lt;/P&gt;&lt;P&gt;        oGoodsmvtItem.Value(1, "ENTRY_QNT") = 1&lt;/P&gt;&lt;P&gt;        oGoodsmvtItem.Value(1, "QUANTITY") = 1&lt;/P&gt;&lt;P&gt;        oGoodsmvtItem.Value(1, "MOVE_PLANT") = "1111"&lt;/P&gt;&lt;P&gt;        oGoodsmvtItem.Value(1, "MOVE_STLOC") = "0001"&lt;/P&gt;&lt;P&gt;        'oGoodsmvtItem.value(1, "MOVE_REAS") = "Test"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        Console.WriteLine("Values Assigned")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        oGoodsmvt.CreateFromData(GoodsmvtHeader:=oGoodsmvtHeader, _&lt;/P&gt;&lt;P&gt;                                 GoodsmvtCode:=oGoodsmvtCode, _&lt;/P&gt;&lt;P&gt;                                 goodsmvtItem:=oGoodsmvtItem, _&lt;/P&gt;&lt;P&gt;                                 GoodsmvtSerialnumber:=oGoodsmvtSerialnumber, _&lt;/P&gt;&lt;P&gt;                                 Testrun:="", _&lt;/P&gt;&lt;P&gt;                                 GoodsmvtHeadret:=oGoodsmvtHeadret, _&lt;/P&gt;&lt;P&gt;                                 Return:=oReturn)&lt;/P&gt;&lt;P&gt;        Console.WriteLine("Doc id: " + oGoodsmvtHeadret.value("MAT_DOC"))&lt;/P&gt;&lt;P&gt;        Console.WriteLine("Doc yr: " + oGoodsmvtHeadret.value("DOC_YEAR"))&lt;/P&gt;&lt;P&gt;        &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        'For Each boReturn In oReturn&lt;/P&gt;&lt;P&gt;        '    Console.WriteLine("Return Type:" + boReturn.value("TYPE"))&lt;/P&gt;&lt;P&gt;        '    Console.WriteLine(boReturn.value("MESSAGE_V1"))&lt;/P&gt;&lt;P&gt;        '    Console.WriteLine(boReturn.value("MESSAGE_V2"))&lt;/P&gt;&lt;P&gt;        '    Console.WriteLine(boReturn.value("MESSAGE_V3"))&lt;/P&gt;&lt;P&gt;        '    Console.WriteLine(boReturn.value("MESSAGE_V4"))&lt;/P&gt;&lt;P&gt;        '    Console.WriteLine(boReturn.value("PARAMETER"))&lt;/P&gt;&lt;P&gt;        '    Console.WriteLine(boReturn.value("FIELD"))&lt;/P&gt;&lt;P&gt;        '    Console.WriteLine(boReturn.value("ROW"))&lt;/P&gt;&lt;P&gt;        'Next&lt;/P&gt;&lt;P&gt;        &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        strTID = oBAPICtrl.CreateTransactionID&lt;/P&gt;&lt;P&gt;        Console.WriteLine(strTID)&lt;/P&gt;&lt;P&gt;        Console.ReadLine()&lt;/P&gt;&lt;P&gt;        oBAPICtrl.Connection.Logoff()&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;   &lt;/P&gt;&lt;P&gt;End Module&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Dec 2007 12:26:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/active-x-bapi-commit/m-p/3167380#M753533</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-19T12:26:08Z</dc:date>
    </item>
    <item>
      <title>Re: Active X bapi commit</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/active-x-bapi-commit/m-p/3167381#M753534</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi John,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm not sure exactlty which BAPI you are calling (I don't understand vb.net and can't see a recognisable BAPI name in your code!) but I'm 99% positive that yes you were correct, you will need to call a commit after the BAPI call.  The BAPI will work correctly without this and pass a material document as you are seeing but won't actually commit the data to the DB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You have 2 options:-&lt;/P&gt;&lt;P&gt;1. Get an ABAPer to create a custom BAPI that includes the standard goods movement BAPI followed by BAPI_TRANSACTION_COMMIT all packaged up so you still only have 1 object to call.&lt;/P&gt;&lt;P&gt;2. Call the BAPI_TRANSACTION_COMMIT straight after the goods movement call.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Gareth.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Dec 2007 13:25:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/active-x-bapi-commit/m-p/3167381#M753534</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-19T13:25:53Z</dc:date>
    </item>
    <item>
      <title>Re: Active X bapi commit</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/active-x-bapi-commit/m-p/3167382#M753535</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your input Gareth.   The bapi that is being called is 'BAPI_GOODSMVT_CREATE'.   The object exposed is GoodsMovement and the method is CreateFromData.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am probably missing something simple as this my first attempt to do this.   I have not seen an example of how to send a commit instruction from VB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;All help appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;John.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Dec 2007 08:58:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/active-x-bapi-commit/m-p/3167382#M753535</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-20T08:58:40Z</dc:date>
    </item>
    <item>
      <title>Re: Active X bapi commit</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/active-x-bapi-commit/m-p/3167383#M753536</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi John,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I suspected it might be that BAPI - to confirm then, it does NOT perform a commit itself so you will have to do so manually in the call to SAP.  On the SAP system there is another BAPI called BAPI_TRANSACTION_COMMIT which should be called directly after your goods movment call assuming there were no errors returned from it.  I don't know how to call multiple BAPI's via VB (I don't know anything about VB in fact!) so can only suggest searching or seeing if there is anything on help.sap.com sorry.  The other alternative (if you have a friendly ABAPer handy) is to create a custom BAPI that wraps both the goods movement and the commit calls together into one and performs the commit if the goods movement is created without errors.  This means just one call to SAP and is a solution I often use when calling SAP from Java.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Gareth.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Dec 2007 09:27:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/active-x-bapi-commit/m-p/3167383#M753536</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-20T09:27:03Z</dc:date>
    </item>
    <item>
      <title>Re: Active X bapi commit</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/active-x-bapi-commit/m-p/3167384#M753537</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Gareth,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you have some sample code showing how you call the commit proceedure from Java.   I should be able to translate this into VB or C#.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If possible I would like to keep all my code in one place.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;John.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Dec 2007 09:52:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/active-x-bapi-commit/m-p/3167384#M753537</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-20T09:52:51Z</dc:date>
    </item>
    <item>
      <title>Re: Active X bapi commit</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/active-x-bapi-commit/m-p/3167385#M753538</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have not yet figured out how to commit my transaction if anybody can help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;John.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Dec 2007 15:47:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/active-x-bapi-commit/m-p/3167385#M753538</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-20T15:47:49Z</dc:date>
    </item>
    <item>
      <title>Re: Active X bapi commit</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/active-x-bapi-commit/m-p/3167386#M753539</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I eventually found the solution.  For those who are interested the object is BapiService and the method is TransactionCommit.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;John.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Dec 2007 16:25:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/active-x-bapi-commit/m-p/3167386#M753539</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-20T16:25:36Z</dc:date>
    </item>
  </channel>
</rss>

