<?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 Excel VBA to SAP transaction Loop in SAP CodeJam Discussions</title>
    <link>https://community.sap.com/t5/sap-codejam-discussions/excel-vba-to-sap-transaction-loop/m-p/11920480#M154</link>
    <description>&lt;P&gt;Hi All,&lt;/P&gt;
  &lt;P&gt;Please advice, I am trying to run my VBA script to SAP updating 1 or more transaction. but It complete only one transaction.&lt;/P&gt;
  &lt;P&gt;Below is my Macro code.&lt;/P&gt;
  &lt;P&gt;&lt;BR /&gt;Private Sub CommandButton1_Click() On Error GoTo Err_NoSAP If Not IsObject(SAPGuiApp) Then&lt;BR /&gt; Set SapGuiAuto = GetObject("SAPGUI")&lt;BR /&gt; Set SAPGuiApp = SapGuiAuto.GetScriptingEngine&lt;BR /&gt;End If&lt;BR /&gt;If Not IsObject(Connection) Then&lt;BR /&gt; Set Connection = SAPGuiApp.Children(0)&lt;BR /&gt;End If&lt;BR /&gt;If Not IsObject(SAP_session) Then&lt;BR /&gt; Set SAP_session = Connection.Children(0)&lt;BR /&gt;End If&lt;BR /&gt;If IsObject(WScript) Then&lt;BR /&gt; WScript.ConnectObject SAP_session, "on"&lt;BR /&gt;WScript.ConnectObject SAPGuiApp, "on"&lt;BR /&gt;End If If (Connection.Children.Count &amp;gt; 1) Then GoTo Err_TooManySAP On Error GoTo Err_Description SAP_session.FindById("wnd[0]").Maximize&lt;BR /&gt;SAP_session.FindById("wnd[0]/tbar[0]/okcd").Text = "ZMMP_ARETURN"&lt;BR /&gt;SAP_session.FindById("wnd[0]").sendVKey 0&lt;BR /&gt;SAP_session.FindById("wnd[0]/usr/ctxtP_MATNR").Text = Cells(11, 1).Value&lt;BR /&gt;SAP_session.FindById("wnd[0]/usr/ctxtP_SERNR").Text = Cells(11, 2).Value&lt;BR /&gt;SAP_session.FindById("wnd[0]/usr/ctxtP_LGORT").Text = Cells(11, 3).Value&lt;BR /&gt;SAP_session.FindById("wnd[0]/usr/txtP_SGTXT").Text = Cells(11, 4).Value&lt;BR /&gt;SAP_session.FindById("wnd[0]/usr/ctxtP_SURR").Text = Cells(11, 5).Value&lt;BR /&gt;SAP_session.FindById("wnd[0]/usr/ctxtP_SURR").SetFocus&lt;BR /&gt;SAP_session.FindById("wnd[0]/usr/ctxtP_SURR").caretPosition = 4&lt;BR /&gt;SAP_session.FindById("wnd[0]").sendVKey 8 &lt;/P&gt;
  &lt;P&gt;Exit Sub Err_Description: &lt;BR /&gt; MsgBox ("The program has generated an error;" &amp;amp; Chr(13) &amp;amp; _ &lt;BR /&gt; "the reason for this error is unknown."), vbInformation, _ &lt;BR /&gt; "For Information..." &lt;BR /&gt; Exit Sub Err_NoSAP: &lt;BR /&gt;MsgBox ("You don't have SAP open or " &amp;amp; Chr(13) &amp;amp; _ &lt;BR /&gt;"scripting has been disabled."), vbInformation, _ &lt;BR /&gt;"For Information..." &lt;BR /&gt; Exit Sub Err_TooManySAP: &lt;BR /&gt;MsgBox ("You must only have one SAP session open. " &amp;amp; Chr(13) &amp;amp; _ &lt;BR /&gt; "Please close all other open SAP sessions."), vbInformation, _ &lt;BR /&gt; "For Information..." &lt;BR /&gt; Exit Sub &lt;BR /&gt;End Sub Private Sub Worksheet_SelectionChange(ByVal Target As Range) End Sub &lt;/P&gt;
  &lt;P&gt;&lt;STRONG&gt;&lt;/STRONG&gt;&lt;U&gt;&lt;/U&gt;&lt;SUB&gt;&lt;/SUB&gt;&lt;SUP&gt;&lt;/SUP&gt; 
   &lt;DEL&gt;&lt;/DEL&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 31 May 2019 09:54:02 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2019-05-31T09:54:02Z</dc:date>
    <item>
      <title>Excel VBA to SAP transaction Loop</title>
      <link>https://community.sap.com/t5/sap-codejam-discussions/excel-vba-to-sap-transaction-loop/m-p/11920480#M154</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;
  &lt;P&gt;Please advice, I am trying to run my VBA script to SAP updating 1 or more transaction. but It complete only one transaction.&lt;/P&gt;
  &lt;P&gt;Below is my Macro code.&lt;/P&gt;
  &lt;P&gt;&lt;BR /&gt;Private Sub CommandButton1_Click() On Error GoTo Err_NoSAP If Not IsObject(SAPGuiApp) Then&lt;BR /&gt; Set SapGuiAuto = GetObject("SAPGUI")&lt;BR /&gt; Set SAPGuiApp = SapGuiAuto.GetScriptingEngine&lt;BR /&gt;End If&lt;BR /&gt;If Not IsObject(Connection) Then&lt;BR /&gt; Set Connection = SAPGuiApp.Children(0)&lt;BR /&gt;End If&lt;BR /&gt;If Not IsObject(SAP_session) Then&lt;BR /&gt; Set SAP_session = Connection.Children(0)&lt;BR /&gt;End If&lt;BR /&gt;If IsObject(WScript) Then&lt;BR /&gt; WScript.ConnectObject SAP_session, "on"&lt;BR /&gt;WScript.ConnectObject SAPGuiApp, "on"&lt;BR /&gt;End If If (Connection.Children.Count &amp;gt; 1) Then GoTo Err_TooManySAP On Error GoTo Err_Description SAP_session.FindById("wnd[0]").Maximize&lt;BR /&gt;SAP_session.FindById("wnd[0]/tbar[0]/okcd").Text = "ZMMP_ARETURN"&lt;BR /&gt;SAP_session.FindById("wnd[0]").sendVKey 0&lt;BR /&gt;SAP_session.FindById("wnd[0]/usr/ctxtP_MATNR").Text = Cells(11, 1).Value&lt;BR /&gt;SAP_session.FindById("wnd[0]/usr/ctxtP_SERNR").Text = Cells(11, 2).Value&lt;BR /&gt;SAP_session.FindById("wnd[0]/usr/ctxtP_LGORT").Text = Cells(11, 3).Value&lt;BR /&gt;SAP_session.FindById("wnd[0]/usr/txtP_SGTXT").Text = Cells(11, 4).Value&lt;BR /&gt;SAP_session.FindById("wnd[0]/usr/ctxtP_SURR").Text = Cells(11, 5).Value&lt;BR /&gt;SAP_session.FindById("wnd[0]/usr/ctxtP_SURR").SetFocus&lt;BR /&gt;SAP_session.FindById("wnd[0]/usr/ctxtP_SURR").caretPosition = 4&lt;BR /&gt;SAP_session.FindById("wnd[0]").sendVKey 8 &lt;/P&gt;
  &lt;P&gt;Exit Sub Err_Description: &lt;BR /&gt; MsgBox ("The program has generated an error;" &amp;amp; Chr(13) &amp;amp; _ &lt;BR /&gt; "the reason for this error is unknown."), vbInformation, _ &lt;BR /&gt; "For Information..." &lt;BR /&gt; Exit Sub Err_NoSAP: &lt;BR /&gt;MsgBox ("You don't have SAP open or " &amp;amp; Chr(13) &amp;amp; _ &lt;BR /&gt;"scripting has been disabled."), vbInformation, _ &lt;BR /&gt;"For Information..." &lt;BR /&gt; Exit Sub Err_TooManySAP: &lt;BR /&gt;MsgBox ("You must only have one SAP session open. " &amp;amp; Chr(13) &amp;amp; _ &lt;BR /&gt; "Please close all other open SAP sessions."), vbInformation, _ &lt;BR /&gt; "For Information..." &lt;BR /&gt; Exit Sub &lt;BR /&gt;End Sub Private Sub Worksheet_SelectionChange(ByVal Target As Range) End Sub &lt;/P&gt;
  &lt;P&gt;&lt;STRONG&gt;&lt;/STRONG&gt;&lt;U&gt;&lt;/U&gt;&lt;SUB&gt;&lt;/SUB&gt;&lt;SUP&gt;&lt;/SUP&gt; 
   &lt;DEL&gt;&lt;/DEL&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 31 May 2019 09:54:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/sap-codejam-discussions/excel-vba-to-sap-transaction-loop/m-p/11920480#M154</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2019-05-31T09:54:02Z</dc:date>
    </item>
  </channel>
</rss>

