<?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 downloading multiple company code reports using SAP script in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/downloading-multiple-company-code-reports-using-sap-script/m-p/684123#M30555</link>
    <description>&lt;P&gt;Hello Experts, &lt;/P&gt;
  &lt;P&gt;&lt;/P&gt;
  &lt;P&gt;I've a very little knowledge about SAP script recording and hence need your help writing a script to automate a report downloading.&lt;/P&gt;
  &lt;P&gt;I've around 40 company codes whose asset history report needs to be downloaded every month. I need to download each company's asset history file and save it in a folder. most of the parameters under asset history sheet will be same but only co. code will change.&lt;/P&gt;
  &lt;P&gt;I am pasting the code below. could you please tell me is there any way to change the code to download each report separately, rename it to match the co.code and save it in a desired folder??&lt;/P&gt;
  &lt;P&gt;Your help will be highly appreciated&lt;/P&gt;
  &lt;P&gt;thank you !&lt;/P&gt;
  &lt;P&gt;Praveen&lt;/P&gt;
  &lt;P&gt;&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;If Not IsObject(application) Then
   Set SapGuiAuto  = GetObject("SAPGUI")
   Set application = SapGuiAuto.GetScriptingEngine
End If
If Not IsObject(connection) Then
   Set connection = application.Children(0)
End If
If Not IsObject(session) Then
   Set session    = connection.Children(0)
End If
If IsObject(WScript) Then
   WScript.ConnectObject session,     "on"
   WScript.ConnectObject application, "on"
End If
session.findById("wnd[0]").maximize
session.findById("wnd[0]/tbar[0]/okcd").text = "/nS_ALR_87011990 "
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/usr/chkPA_XGBAF").selected = true
session.findById("wnd[0]/usr/ctxtBERDATUM").text = "09/30/2018"
session.findById("wnd[0]/usr/ctxtSRTVR").text = "0003"
session.findById("wnd[0]/usr/chkPA_XGBAF").setFocus
session.findById("wnd[0]/tbar[1]/btn[8]").press
session.findById("wnd[0]/mbar/menu[0]/menu[1]/menu[2]").select
session.findById("wnd[1]/usr/subSUBSCREEN_STEPLOOP:SAPLSPO5:0150/sub:SAPLSPO5:0150/radSPOPLI-SELFLAG[1,0]").select
session.findById("wnd[1]/usr/subSUBSCREEN_STEPLOOP:SAPLSPO5:0150/sub:SAPLSPO5:0150/radSPOPLI-SELFLAG[1,0]").setFocus
session.findById("wnd[1]/tbar[0]/btn[0]").press
session.findById("wnd[1]/usr/ctxtDY_PATH").setFocus
session.findById("wnd[1]/usr/ctxtDY_PATH").caretPosition = 0
session.findById("wnd[1]").sendVKey 4
session.findById("wnd[2]/usr/ctxtDY_PATH").setFocus
session.findById("wnd[2]/usr/ctxtDY_PATH").caretPosition = 0
session.findById("wnd[2]").sendVKey 4
session.findById("wnd[3]/usr/ctxtDY_PATH").setFocus
session.findById("wnd[3]/usr/ctxtDY_PATH").caretPosition = 0
session.findById("wnd[3]").sendVKey 4  &lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 18 Oct 2018 07:41:09 GMT</pubDate>
    <dc:creator>former_member1231565</dc:creator>
    <dc:date>2018-10-18T07:41:09Z</dc:date>
    <item>
      <title>downloading multiple company code reports using SAP script</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/downloading-multiple-company-code-reports-using-sap-script/m-p/684123#M30555</link>
      <description>&lt;P&gt;Hello Experts, &lt;/P&gt;
  &lt;P&gt;&lt;/P&gt;
  &lt;P&gt;I've a very little knowledge about SAP script recording and hence need your help writing a script to automate a report downloading.&lt;/P&gt;
  &lt;P&gt;I've around 40 company codes whose asset history report needs to be downloaded every month. I need to download each company's asset history file and save it in a folder. most of the parameters under asset history sheet will be same but only co. code will change.&lt;/P&gt;
  &lt;P&gt;I am pasting the code below. could you please tell me is there any way to change the code to download each report separately, rename it to match the co.code and save it in a desired folder??&lt;/P&gt;
  &lt;P&gt;Your help will be highly appreciated&lt;/P&gt;
  &lt;P&gt;thank you !&lt;/P&gt;
  &lt;P&gt;Praveen&lt;/P&gt;
  &lt;P&gt;&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;If Not IsObject(application) Then
   Set SapGuiAuto  = GetObject("SAPGUI")
   Set application = SapGuiAuto.GetScriptingEngine
End If
If Not IsObject(connection) Then
   Set connection = application.Children(0)
End If
If Not IsObject(session) Then
   Set session    = connection.Children(0)
End If
If IsObject(WScript) Then
   WScript.ConnectObject session,     "on"
   WScript.ConnectObject application, "on"
End If
session.findById("wnd[0]").maximize
session.findById("wnd[0]/tbar[0]/okcd").text = "/nS_ALR_87011990 "
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/usr/chkPA_XGBAF").selected = true
session.findById("wnd[0]/usr/ctxtBERDATUM").text = "09/30/2018"
session.findById("wnd[0]/usr/ctxtSRTVR").text = "0003"
session.findById("wnd[0]/usr/chkPA_XGBAF").setFocus
session.findById("wnd[0]/tbar[1]/btn[8]").press
session.findById("wnd[0]/mbar/menu[0]/menu[1]/menu[2]").select
session.findById("wnd[1]/usr/subSUBSCREEN_STEPLOOP:SAPLSPO5:0150/sub:SAPLSPO5:0150/radSPOPLI-SELFLAG[1,0]").select
session.findById("wnd[1]/usr/subSUBSCREEN_STEPLOOP:SAPLSPO5:0150/sub:SAPLSPO5:0150/radSPOPLI-SELFLAG[1,0]").setFocus
session.findById("wnd[1]/tbar[0]/btn[0]").press
session.findById("wnd[1]/usr/ctxtDY_PATH").setFocus
session.findById("wnd[1]/usr/ctxtDY_PATH").caretPosition = 0
session.findById("wnd[1]").sendVKey 4
session.findById("wnd[2]/usr/ctxtDY_PATH").setFocus
session.findById("wnd[2]/usr/ctxtDY_PATH").caretPosition = 0
session.findById("wnd[2]").sendVKey 4
session.findById("wnd[3]/usr/ctxtDY_PATH").setFocus
session.findById("wnd[3]/usr/ctxtDY_PATH").caretPosition = 0
session.findById("wnd[3]").sendVKey 4  &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 18 Oct 2018 07:41:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/downloading-multiple-company-code-reports-using-sap-script/m-p/684123#M30555</guid>
      <dc:creator>former_member1231565</dc:creator>
      <dc:date>2018-10-18T07:41:09Z</dc:date>
    </item>
    <item>
      <title>Re: downloading multiple company code reports using SAP script</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/downloading-multiple-company-code-reports-using-sap-script/m-p/684124#M30556</link>
      <description>&lt;P&gt;I did a quick search on:&lt;/P&gt;&lt;P&gt;sap IsObject(WScript) loop&lt;/P&gt;&lt;P&gt;I think this message would help you out.   You really need to do a loop in the code.  Since that isn't possible take a look at &lt;A href="https://archive.sap.com/discussions/thread/3578892"&gt;this post.&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Oct 2018 11:55:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/downloading-multiple-company-code-reports-using-sap-script/m-p/684124#M30556</guid>
      <dc:creator>mmcisme1</dc:creator>
      <dc:date>2018-10-18T11:55:56Z</dc:date>
    </item>
  </channel>
</rss>

