<?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 input the data list to SAP one by one from Excel by Python in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-input-the-data-list-to-sap-one-by-one-from-excel-by-python/m-p/12509856#M2003950</link>
    <description>&lt;P&gt;Thank you for visiting SAP Community to get answers to your
questions.&lt;/P&gt;

&lt;P&gt;Since you're asking a question here for the
first time, I'd like to recommend you with the following steps so you can get
the most out of your community membership:&lt;/P&gt;

&lt;UL&gt;
 &lt;LI&gt;Please
     see: &lt;A href="https://community.sap.com/resources/questions-and-answers"&gt;https://community.sap.com/resources/questions-and-answers&lt;/A&gt; as
     this resource page provides tips for preparing questions that draw
     responses from our members&lt;/LI&gt;
 &lt;LI&gt;Consider
     to take our Q&amp;amp;A tutorial at: &lt;A href="https://developers.sap.com/tutorials/community-qa.html" target="_blank"&gt;https://developers.sap.com/tutorials/community-qa.html&lt;/A&gt;.
     as that will help you when submitting questions to the community.&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;I also recommend that you include a profile
picture. By personalizing your profile, you encourage readers to respond: &lt;A href="https://developers.sap.com/tutorials/community-profile.html" target="_blank"&gt;https://developers.sap.com/tutorials/community-profile.html&lt;/A&gt;.&lt;/P&gt;

&lt;P&gt;I hope you find this advice useful, and we're
happy to have you as part of SAP Community!&lt;/P&gt;

&lt;P&gt;All the best,&lt;BR /&gt;
-Alex&lt;/P&gt;</description>
    <pubDate>Thu, 21 Apr 2022 20:08:36 GMT</pubDate>
    <dc:creator>AlexGourdet</dc:creator>
    <dc:date>2022-04-21T20:08:36Z</dc:date>
    <item>
      <title>How to input the data list to SAP one by one from Excel by Python</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-input-the-data-list-to-sap-one-by-one-from-excel-by-python/m-p/12509855#M2003949</link>
      <description>&lt;P&gt;Hello, I'm a bignner in sapscript by python, I would like to import the data list from excel one by one to SAP to do some repeat operation automaticlly, how can I realize it? here is the code for your reference, thank you!&lt;/P&gt;
  &lt;P&gt;#log on SAP&lt;/P&gt;
  &lt;P&gt;import win32com.client &lt;/P&gt;
  &lt;P&gt;import subprocess&lt;/P&gt;
  &lt;P&gt;import sys&lt;/P&gt;
  &lt;P&gt;import time&lt;/P&gt;
  &lt;P&gt;import getpass&lt;/P&gt;
  &lt;P&gt;user=getpass.getuser()&lt;/P&gt;
  &lt;P&gt;SapGuiAuto = win32com.client.GetObject("SAPGUI")&lt;/P&gt;
  &lt;P&gt;application = SapGuiAuto.GetScriptingEngine&lt;/P&gt;
  &lt;P&gt;connection = application.Children(0)&lt;/P&gt;
  &lt;P&gt;session = connection.Children(0)&lt;/P&gt;
  &lt;P&gt;#Import pandas&lt;/P&gt;
  &lt;P&gt;import pandas as pd&lt;/P&gt;
  &lt;P&gt;import numpy as np&lt;/P&gt;
  &lt;P&gt;data=pd.read_excel("Order List.xlsx",sheet_name="Sheet1")&lt;/P&gt;
  &lt;P&gt;to_SAP=data['order'].reset_index(drop=True)&lt;/P&gt;
  &lt;P&gt;orderlist=to_SAP.values.tolist()&lt;/P&gt;
  &lt;P&gt;orderlist&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;[983424744,
 983117520,
 983117520,
 983117513,
 983117496,
 983117510,
 983117514,
 983117514,
 983495624]&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;def input_order(orderlist):&lt;/P&gt;
  &lt;P&gt; for order in orderlist:&lt;/P&gt;
  &lt;P&gt; session.findById("wnd[0]").maximize()&lt;/P&gt;
  &lt;P&gt; session.findById("wnd[0]/tbar[0]/okcd").text = "va03"&lt;/P&gt;
  &lt;P&gt; session.findById("wnd[0]").sendVKey(0)&lt;/P&gt;
  &lt;P&gt; session.findById("wnd[0]/usr/ctxtVBAK-VBELN").text = order (here I would like to loop order in excel)&lt;/P&gt;
  &lt;P&gt; session.findById("wnd[0]").sendVKey(0)&lt;/P&gt;
  &lt;P&gt; session.findById("wnd[0]/tbar[0]/okcd").text = "/n"&lt;/P&gt;
  &lt;P&gt; session.findById("wnd[0]").sendVKey(0)&lt;/P&gt;
  &lt;P&gt;input_order(orderlist)&lt;BR /&gt;&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;---------------------------------------------------------------------------
com_error                                 Traceback (most recent call last)
&amp;lt;ipython-input-119-d366b506afd0&amp;gt; in &amp;lt;module&amp;gt;()
----&amp;gt; 1 input_order(orderlist)

&amp;lt;ipython-input-118-c89372a1fd5d&amp;gt; in input_order(orderlist)
      4         session.findById("wnd[0]/tbar[0]/okcd").text = "va03"
      5         session.findById("wnd[0]").sendVKey(0)
----&amp;gt; 6         session.findById("wnd[0]/usr/ctxtVBAK-VBELN").text = order
      7         session.findById("wnd[0]").sendVKey(0)
      8         session.findById("wnd[0]/tbar[0]/okcd").text = "/n"

D:\Python\lib\site-packages\win32com\client\dynamic.py in findById(self, *args)

com_error: (-2147352567, 'Exception occurred.', (619, 'SAP Frontend Server', 'The control could not be found by id.', 'c:\\program files (x86)\\sap\\frontend\\sapgui\\sapfront.HLP', 393215, 0), None)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 21 Apr 2022 20:08:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-input-the-data-list-to-sap-one-by-one-from-excel-by-python/m-p/12509855#M2003949</guid>
      <dc:creator>former_member1143722</dc:creator>
      <dc:date>2022-04-21T20:08:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to input the data list to SAP one by one from Excel by Python</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-input-the-data-list-to-sap-one-by-one-from-excel-by-python/m-p/12509856#M2003950</link>
      <description>&lt;P&gt;Thank you for visiting SAP Community to get answers to your
questions.&lt;/P&gt;

&lt;P&gt;Since you're asking a question here for the
first time, I'd like to recommend you with the following steps so you can get
the most out of your community membership:&lt;/P&gt;

&lt;UL&gt;
 &lt;LI&gt;Please
     see: &lt;A href="https://community.sap.com/resources/questions-and-answers"&gt;https://community.sap.com/resources/questions-and-answers&lt;/A&gt; as
     this resource page provides tips for preparing questions that draw
     responses from our members&lt;/LI&gt;
 &lt;LI&gt;Consider
     to take our Q&amp;amp;A tutorial at: &lt;A href="https://developers.sap.com/tutorials/community-qa.html" target="_blank"&gt;https://developers.sap.com/tutorials/community-qa.html&lt;/A&gt;.
     as that will help you when submitting questions to the community.&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;I also recommend that you include a profile
picture. By personalizing your profile, you encourage readers to respond: &lt;A href="https://developers.sap.com/tutorials/community-profile.html" target="_blank"&gt;https://developers.sap.com/tutorials/community-profile.html&lt;/A&gt;.&lt;/P&gt;

&lt;P&gt;I hope you find this advice useful, and we're
happy to have you as part of SAP Community!&lt;/P&gt;

&lt;P&gt;All the best,&lt;BR /&gt;
-Alex&lt;/P&gt;</description>
      <pubDate>Thu, 21 Apr 2022 20:08:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-input-the-data-list-to-sap-one-by-one-from-excel-by-python/m-p/12509856#M2003950</guid>
      <dc:creator>AlexGourdet</dc:creator>
      <dc:date>2022-04-21T20:08:36Z</dc:date>
    </item>
  </channel>
</rss>

