Hello, I am lookin for help.
I have a script which goes to SU01 and select the filed CLASS in user master record. I would like to export the field value of field CLASS into my VBA where I start the SAP scripting. Enclosed my code which does not work.. Thanks for help. Nguyen
Sub test()
If Not IsObject(SAPguiApp) Then
Set SAPguiApp = CreateObject("Sapgui.ScriptingCtrl.1")
End If
If Not IsObject(Connection) Then
Set Connection = SAPguiApp.OpenConnection("xxx", True)
End If
If Not IsObject(session) Then
Set session = Connection.Children(0)
End If
session.findById("wnd[0]/usr/txtRSYST-MANDT").Text = "xxx"
session.findById("wnd[0]/usr/txtRSYST-BNAME").Text = "xxx"
session.findById("wnd[0]/usr/pwdRSYST-BCODE").Text = "xxx"
session.findById("wnd[0]").resizeWorkingPane 120, 37, False
session.findById("wnd[0]/tbar[0]/okcd").Text = "SU01"
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/usr/ctxtSUID_ST_BNAME-BNAME").Text = "xxx"
session.findById("wnd[0]/tbar[1]/btn[7]").press
session.findById("wnd[0]/usr/tabsTABSTRIP1/tabpLOGO").Select
session.findById("wnd[0]/usr/tabsTABSTRIP1/tabpLOGO/ssubMAINAREA:SAPLSUID_MAINTENANCE:1101/ctxtSUID_ST_NODE_LOGONDATA-CLASS").SetFocus
session.findById("wnd[0]/usr/tabsTABSTRIP1/tabpLOGO/ssubMAINAREA:SAPLSUID_MAINTENANCE:1101/ctxtSUID_ST_NODE_LOGONDATA-CLASS").caretPosition = 5
session.findById("wnd[0]/usr/tabsTABSTRIP1/tabpLOGO/ssubMAINAREA:SAPLSUID_MAINTENANCE:1101/ctxtSUID_ST_NODE_LOGONDATA-CLASS").Text = n '--------->error, does not work, what is the correct code?
session.findById("wnd[0]/tbar[0]/btn[15]").press
session.findById("wnd[0]/tbar[0]/btn[15]").press
MsgBox n
session.findById("wnd[0]").sendVKey 0
End Sub