Retrieve Value from SAP Field

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
 

Some videos you may like

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number

Watch MrExcel Video

Forum statistics

Threads
1,122,737
Messages
5,597,826
Members
414,180
Latest member
Sir Khaya

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top