Brandon2Jackson
New Member
- Joined
- Sep 12, 2018
- Messages
- 1
Guys im having trouble getting the value from an SAP field into my excel Column. I need to get the following value to copy into cell C5. I cant get SAP To copy the value or insert it into cell c5. all help appreciated.
Set sapguiauto = GetObject("SAPGUI")
Set app = sapguiauto.GetScriptingEngine
If app.Connections.Count() = 0 Then
Set Connection = app.OpenConnection("3. PE3 - GEIS PRD logon for SCM Team", True)
Set session = Connection.Children(0)
session.findById("wnd[0]/usr/txtRSYST-MANDT").Text = "360"
session.findById("wnd[0]/usr/txtRSYST-BNAME").Text = Worksheets("Steel Fab Orders").Range("B1").Value
session.findById("wnd[0]/usr/pwdRSYST-BCODE").Text = Worksheets("Steel Fab Orders").Range("B2").Value
session.findById("wnd[0]/usr/txtRSYST-LANGU").Text = "EN"
session.findById("wnd[0]").sendVKey 0
On Error Resume Next
session.findById("wnd[1]/usr/radMULTI_LOGON_OPT1").Select
session.findById("wnd[1]/usr/radMULTI_LOGON_OPT1").SetFocus
session.findById("wnd[1]/tbar[0]/btn[0]").press
Else
Set Connection = app.Children(0)
Set session = Connection.Children(0)
End If
Set session = Connection.Children(0)
'session.findById("wnd[0]").maximize
'AppActivate "MIGO.xlsm"
session.findById("wnd[0]").maximize
session.findById("wnd[0]/tbar[0]/okcd").Text = "/nse16n"
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/usr/ctxtGD-TAB").Text = "afru"
session.findById("wnd[0]/usr/ctxtGD-TAB").caretPosition = 4
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/usr/tblSAPLSE16NSELFIELDS_TC/ctxtGS_SELFIELDS-LOW[2,9]").Text = "us04"
session.findById("wnd[0]/usr/tblSAPLSE16NSELFIELDS_TC/ctxtGS_SELFIELDS-LOW[2,9]").SetFocus
session.findById("wnd[0]/usr/tblSAPLSE16NSELFIELDS_TC/ctxtGS_SELFIELDS-LOW[2,9]").caretPosition = 4
session.findById("wnd[0]/usr/tblSAPLSE16NSELFIELDS_TC").verticalScrollbar.Position = 74
session.findById("wnd[0]/usr/tblSAPLSE16NSELFIELDS_TC").verticalScrollbar.Position = 71
session.findById("wnd[0]/usr/tblSAPLSE16NSELFIELDS_TC").verticalScrollbar.Position = 68
session.findById("wnd[0]/usr/tblSAPLSE16NSELFIELDS_TC").verticalScrollbar.Position = 65
session.findById("wnd[0]/usr/tblSAPLSE16NSELFIELDS_TC").verticalScrollbar.Position = 62
session.findById("wnd[0]/usr/tblSAPLSE16NSELFIELDS_TC/ctxtGS_SELFIELDS-LOW[2,5]").Text = "441000608984"
session.findById("wnd[0]/usr/tblSAPLSE16NSELFIELDS_TC/ctxtGS_SELFIELDS-LOW[2,5]").SetFocus
session.findById("wnd[0]/usr/tblSAPLSE16NSELFIELDS_TC/ctxtGS_SELFIELDS-LOW[2,5]").caretPosition = 12
session.findById("wnd[0]/tbar[1]/btn[8]").press
session.findById("wnd[0]/usr/cntlRESULT_LIST/shellcont/shell").currentCellRow = -1
session.findById("wnd[0]/usr/cntlRESULT_LIST/shellcont/shell").selectColumn "RUECK"
session.findById("wnd[0]/usr/cntlRESULT_LIST/shellcont/shell").pressToolbarButton "&SORT_DSC"
session.findById("wnd[0]/usr/cntlRESULT_LIST/shellcont/shell").contextMenu
session.findById("wnd[0]/usr/cntlRESULT_LIST/shellcont/shell").pressToolbarButton "&DETAIL"
session.findById("wnd[1]/usr/cntlGRID/shellcont/shell").setCurrentCell 1, "VALUE"
Worksheets("Steel Fab Orders").Activate
Range("C5").Select
Set sapguiauto = GetObject("SAPGUI")
Set app = sapguiauto.GetScriptingEngine
If app.Connections.Count() = 0 Then
Set Connection = app.OpenConnection("3. PE3 - GEIS PRD logon for SCM Team", True)
Set session = Connection.Children(0)
session.findById("wnd[0]/usr/txtRSYST-MANDT").Text = "360"
session.findById("wnd[0]/usr/txtRSYST-BNAME").Text = Worksheets("Steel Fab Orders").Range("B1").Value
session.findById("wnd[0]/usr/pwdRSYST-BCODE").Text = Worksheets("Steel Fab Orders").Range("B2").Value
session.findById("wnd[0]/usr/txtRSYST-LANGU").Text = "EN"
session.findById("wnd[0]").sendVKey 0
On Error Resume Next
session.findById("wnd[1]/usr/radMULTI_LOGON_OPT1").Select
session.findById("wnd[1]/usr/radMULTI_LOGON_OPT1").SetFocus
session.findById("wnd[1]/tbar[0]/btn[0]").press
Else
Set Connection = app.Children(0)
Set session = Connection.Children(0)
End If
Set session = Connection.Children(0)
'session.findById("wnd[0]").maximize
'AppActivate "MIGO.xlsm"
session.findById("wnd[0]").maximize
session.findById("wnd[0]/tbar[0]/okcd").Text = "/nse16n"
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/usr/ctxtGD-TAB").Text = "afru"
session.findById("wnd[0]/usr/ctxtGD-TAB").caretPosition = 4
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/usr/tblSAPLSE16NSELFIELDS_TC/ctxtGS_SELFIELDS-LOW[2,9]").Text = "us04"
session.findById("wnd[0]/usr/tblSAPLSE16NSELFIELDS_TC/ctxtGS_SELFIELDS-LOW[2,9]").SetFocus
session.findById("wnd[0]/usr/tblSAPLSE16NSELFIELDS_TC/ctxtGS_SELFIELDS-LOW[2,9]").caretPosition = 4
session.findById("wnd[0]/usr/tblSAPLSE16NSELFIELDS_TC").verticalScrollbar.Position = 74
session.findById("wnd[0]/usr/tblSAPLSE16NSELFIELDS_TC").verticalScrollbar.Position = 71
session.findById("wnd[0]/usr/tblSAPLSE16NSELFIELDS_TC").verticalScrollbar.Position = 68
session.findById("wnd[0]/usr/tblSAPLSE16NSELFIELDS_TC").verticalScrollbar.Position = 65
session.findById("wnd[0]/usr/tblSAPLSE16NSELFIELDS_TC").verticalScrollbar.Position = 62
session.findById("wnd[0]/usr/tblSAPLSE16NSELFIELDS_TC/ctxtGS_SELFIELDS-LOW[2,5]").Text = "441000608984"
session.findById("wnd[0]/usr/tblSAPLSE16NSELFIELDS_TC/ctxtGS_SELFIELDS-LOW[2,5]").SetFocus
session.findById("wnd[0]/usr/tblSAPLSE16NSELFIELDS_TC/ctxtGS_SELFIELDS-LOW[2,5]").caretPosition = 12
session.findById("wnd[0]/tbar[1]/btn[8]").press
session.findById("wnd[0]/usr/cntlRESULT_LIST/shellcont/shell").currentCellRow = -1
session.findById("wnd[0]/usr/cntlRESULT_LIST/shellcont/shell").selectColumn "RUECK"
session.findById("wnd[0]/usr/cntlRESULT_LIST/shellcont/shell").pressToolbarButton "&SORT_DSC"
session.findById("wnd[0]/usr/cntlRESULT_LIST/shellcont/shell").contextMenu
session.findById("wnd[0]/usr/cntlRESULT_LIST/shellcont/shell").pressToolbarButton "&DETAIL"
session.findById("wnd[1]/usr/cntlGRID/shellcont/shell").setCurrentCell 1, "VALUE"
Worksheets("Steel Fab Orders").Activate
Range("C5").Select