Quantcast
Viewing all articles
Browse latest Browse all 8501

Re: Start recording directly from Excel

Hi,

 

Below is the blod line is debug.

 

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 = "/nzk97"

session.findById("wnd[0]").sendVKey 0

session.findById("wnd[0]/usr/btn%_DD_KUNNR_%_APP_%-VALU_PUSH").press

session.findById("wnd[1]/usr/tabsTAB_STRIP/tabpSIVA/ssubSCREEN_HEADER:SAPLALDB:3010/tblSAPLALDBSINGLE/ctxtRSCSEL-SLOW_I[1,0]").Text = "10004638"

session.findById("wnd[1]/usr/tabsTAB_STRIP/tabpSIVA/ssubSCREEN_HEADER:SAPLALDB:3010/tblSAPLALDBSINGLE/ctxtRSCSEL-SLOW_I[1,1]").Text = "10054329"

session.findById("wnd[1]/usr/tabsTAB_STRIP/tabpSIVA/ssubSCREEN_HEADER:SAPLALDB:3010/tblSAPLALDBSINGLE/ctxtRSCSEL-SLOW_I[1,1]").SetFocus

session.findById("wnd[1]/usr/tabsTAB_STRIP/tabpSIVA/ssubSCREEN_HEADER:SAPLALDB:3010/tblSAPLALDBSINGLE/ctxtRSCSEL-SLOW_I[1,1]").caretPosition = 8

session.findById("wnd[1]/tbar[0]/btn[8]").press

session.findById("wnd[0]/tbar[1]/btn[8]").press

session.findById("wnd[0]/mbar/menu[0]/menu[3]/menu[1]").Select

session.findById("wnd[1]/usr/radRB_OTHERS").SetFocus

session.findById("wnd[1]/usr/radRB_OTHERS").Select

session.findById("wnd[1]/usr/cmbG_LISTBOX").Key = "08"

session.findById("wnd[1]/tbar[0]/btn[0]").press

session.findById("wnd[1]/tbar[0]/btn[0]").press

session.findById("wnd[1]/usr/subSUBSCREEN_STEPLOOP:SAPLSPO5:0150/sub:SAPLSPO5:0150/radSPOPLI-SELFLAG[0,0]").Select

session.findById("wnd[1]/tbar[0]/btn[0]").press

session.findById("wnd[1]/tbar[0]/btn[0]").press

SAP_Workbook = "Worksheet in ALVXXL01 (1)"

EXCEL_Path = "C:\Users\rahul.chure\Documents\SAP\"

myWorkbook = "open item.xlsx"

On Error Resume Next

Do

Err.Clear

Set xclapp = GetObject(, "Excel.Application")

If Err.Number = 0 Then Exit Do

'msgbox "Wait for Excel session"

wscript.sleep 2000

Loop


Do
Err.Clear
Set xclwbk = xclapp.Workbooks.Item(SAP_Workbook)
If Err.Number = 0 Then Exit Do
'msgbox "Wait for SAP workbook"
wscript.sleep 2000
Loop


On Error GoTo 0


Set xclsheet = xclwbk.Worksheets(1)

xclapp.Visible = True
xclapp.DisplayAlerts = False

xclapp.ActiveWorkbook.SaveAs EXCEL_Path & myWorkbook
xclapp.ActiveWorkbook.Close


Set xclwbk = Nothing
Set xclsheet = Nothing
'xclapp.Quit
Set xclapp = Nothing


Viewing all articles
Browse latest Browse all 8501

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>