2021 Jun 26 7:38 PM
Team,
I am new the GUI Scripting.
Requirement customer block :
SAP record
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 = "XD05"
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/usr/ctxtRF02D-KUNNR").text = "9000018"
session.findById("wnd[0]/usr/ctxtRF02D-BUKRS").text = "1000"
session.findById("wnd[0]/usr/ctxtRF02D-VKORG").text = "1000"
session.findById("wnd[0]/usr/ctxtRF02D-VTWEG").text = "10"
session.findById("wnd[0]/usr/ctxtRF02D-SPART").text = "00"
session.findById("wnd[0]/usr/ctxtRF02D-SPART").setFocus
session.findById("wnd[0]/usr/ctxtRF02D-SPART").caretPosition = 2
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/usr/ctxtKNA1-AUFSD").text = "01"
session.findById("wnd[0]/usr/ctxtKNVV-AUFSD").text = "01"
session.findById("wnd[0]/usr/ctxtKNVV-AUFSD").setFocus
session.findById("wnd[0]/usr/ctxtKNVV-AUFSD").caretPosition = 2
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/tbar[0]/btn[11]").press
Excel file follows.

How to achieve the above with vba code .
Team,
I am new the GUI Scripting.
Requirement customer block :
SAP record
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 = "XD05"
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/usr/ctxtRF02D-KUNNR").text = "9000018"
session.findById("wnd[0]/usr/ctxtRF02D-BUKRS").text = "1000"
session.findById("wnd[0]/usr/ctxtRF02D-VKORG").text = "1000"
session.findById("wnd[0]/usr/ctxtRF02D-VTWEG").text = "10"
session.findById("wnd[0]/usr/ctxtRF02D-SPART").text = "00"
session.findById("wnd[0]/usr/ctxtRF02D-SPART").setFocus
session.findById("wnd[0]/usr/ctxtRF02D-SPART").caretPosition = 2
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/usr/ctxtKNA1-AUFSD").text = "01"
session.findById("wnd[0]/usr/ctxtKNVV-AUFSD").text = "01"
session.findById("wnd[0]/usr/ctxtKNVV-AUFSD").setFocus
session.findById("wnd[0]/usr/ctxtKNVV-AUFSD").caretPosition = 2
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/tbar[0]/btn[11]").press
Excel file follows.

How to achieve the above with vba code .
2021 Jun 26 8:45 PM
It's unrelated to ABAP, better use the tag UI SAP GUI For Windows, although it's a pure Excel/VBScript question, that you should better ask in a Microsoft VBScript forum.
But first of all, it's very easy to use the Excel macro recorder, which produces VBA code. After that, you manually adapt it to become VBScript.
If you need answers for precise questions, you can search the Web, there are so many useful help sites.
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |