on 12-20-2011 2:33 PM
Hello community,
a good way to work with the object hierarchy of SAP GUI scripting is to load the file C:\Program Files\SAP\FrontEnd\SAPgui\sapfewse.ocx - this is the SAP GUI scripting API - in the object catalog of Excel or another Office application. Press Alt + F11 to go to VBA. Choose menu Tools > References and press the button Browse to select sapfewse.ocx. Now press F2 to open the object catalog and choose SAPFEWSELib. You see all classes with their elements and types.
Cheers
Stefan
Mr. Schnell, I am using VBA to manipulate the tcode ME23N. In this screen there are multiple tabs, however i am having difficulty ensuring that the screen is on the right tab. For example, i may be on the delivery schedule tab but i want vba to select that confirmations tab. Sometimes it works, and sometimes it does not. Sometimes when i open ME23N, it is already on the confirmations tab and it will give me an error. Can you provide any guidance? Thank you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Jason,
try this to find a tab with its name:
'-Begin-----------------------------------------------------------------
If Not IsObject(application) Then
Set SapGuiAuto = GetObject("SAPGUI")
Set application = SapGuiAuto.GetScriptingEngine
End If
If Not IsObject(connection) Then
Set connection = application.Children(1)
End If
If Not IsObject(session) Then
Set session = connection.Children(0)
End If
For i = 1 To 5
name = "tabpTABHDT" & CStr(i)
tab = session.findById("wnd[0]/usr/subSUB0:SAPLMEGUI:0013/subSUB1:SAPLMEVIEWS:1100/subSUB2:SAPLMEVIEWS:1200/subSUB1:SAPLMEGUI:1102/tabsHEADER_DETAIL/" & name).text
If tab = "Address" Then
session.findById("wnd[0]/usr/subSUB0:SAPLMEGUI:0013/subSUB1:SAPLMEVIEWS:1100/subSUB2:SAPLMEVIEWS:1200/subSUB1:SAPLMEGUI:1102/tabsHEADER_DETAIL/" & name).select
Exit For
End If
Next
'-End-------------------------------------------------------------------
In this example I search for the address tab:
Cheers
Stefan
Works! Thank you Stefan!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
24 | |
12 | |
9 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.