cancel
Showing results for 
Search instead for 
Did you mean: 

VBA list each control on a pop up form

0 Kudos

Hello

Hope you can help.

I have scoured the internet trying to find a solution with no avail.

Work has locked the VBA, so cannot record. (too easy)

I have excel opening a session, and running a transaction. No problems there.

The problem I have, when export as a spreadsheet, a pop up appears asking a question.

(2 option buttons), Table or Pivot table.

It’s default is Pivot table. I cannot get the handle on the option buttons to select Table.

Is there a way getting the info off the form, or looping the controls, as in excel VBA

Dim CrtCont As Control

For Each CrtCont In UserformSAP.Controls

If TypeName(CrtCont) = "OptionButton" Then

***'Do something like

Session.findByID("wnd[1] /1TableOPTIONBUTTON2").press

End If

Next CrtCont

Any help on this would be great.

Accepted Solutions (1)

Accepted Solutions (1)

stefan_schnell
Active Contributor

Hello Savakis,

I assume you mean a popup window from a grid to export the content. If yes, here an example how it looks in my case. You have full access to the options via the id.

It seems that you have activate LAN Low Speed Connection, switch it to High Speed Connection, maybe this solves your problem. You can find more information here: https://answers.sap.com/questions/12631936/problems-with-sap-macros.html

Best regards
Stefan

0 Kudos

Thank you.

alekks
Explorer
0 Kudos

stefan.schnell May I ask you how I can get that tree view of the id path? I.e. the /app/con[0]/ses[0]/wnd[0] etc.
I've just started scripting with Python and to use findById() most optimal and to troubleshoot, I'd like to be able to print or see the full paths available to be able to pinpoint what I want to find etc.

Many thanks for your help.

stefan_schnell
Active Contributor

Hello alekks,

welcome in the SAP Community.

To analyze the tree you can use Scripting Tracker. The Analyser tab shows a well arranged tree with all sessions and their scripting objects. Also you have the possibility to export all IDs to the clipboard, if it is necessary.

The SAP GUI Scripting recorder of Scripting Tracker offers the possiblity to record, edit and execute your script code in different scripting languages, also Python.

Happy automation.

Best regards
Stefan

Sandra_Rossi
Active Contributor

Alekks Hennig You also have the "screenreader.exe" program provided in the attachments of the SAP note 1441550 - SAP GUI scripting: Sample applications.

alekks
Explorer

sandra.rossi stefan.schnell Many thanks, both of you! This will help a lot!

Answers (5)

Answers (5)

Thank you for your help Stefan

The final answer was as below for the pop up.

Session.findById("wnd[0]/tbar[1]/btn[8]").press '(Execute btn[8])
Session.findById("wnd[0]/tbar[1]/btn[16]").press 'Export SAP
Session.findById("wnd[1]/tbar[0]/btn[0]").press 'Ok tick button
Session.findById("wnd[1]/usr/sub/2/sub/2/1/rad[0,0]").Select 'select Table
Session.findById("wnd[1]/usr/sub/2/sub/2/1/rad[0,0]").SetFocus 'select Table focus
Session.findById("wnd[1]/tbar[0]/btn[0]").press 'Ok tick button
Session.findById("wnd[1]/tbar[0]/btn[0]").press 'Ok tick button excel
stefan_schnell
Active Contributor
0 Kudos

Hello Savakis,

that is so pitty that you don't have the possibility to use SAP GUI Scripting without restrictions. But it is good to know that you find a solution, thanks for sharing.

Best regards
Stefan

Hello Stefan.

I can not access LAN connections at my low level. 🙂

Unfortunately IT have this locked off, we run on Citrix server and have no access to any thing as all locked up by the company.

I switch on script logging and this has now locked SAP with an error, I have contacted IT to try and resolve as no SAP at all at this moment. (SAP script logging has an error somewhere?) SAP issue i think.

Will get back to you when resolved.

But thank you for the work so far.

0 Kudos

Stefan/Sevakis,

We likewise must use SAP GUI via Citrix, which they've turned off delegation on the server such that when the SAP GUI session is launched from the Portal no SAP Logon is initiated. Without this we of course cannot use SAP GUI Script. Are you aware of any workaround to this? I've researched extensively and found OSS Note 844095 which references a command line switch that allows you to override and suppress delegation (/NoDelegate) if the registry setting has been set to the default which is delegation. However it does not document a way to activate delegation via command line if the registry setting has been set to no delegation. Any help you can provide would be much appreciated.

stefan_schnell
Active Contributor
0 Kudos

Hello Savakis,

the setting of the speed is very important for the SAP GUI Scripting. You can find more information here, scroll down until the note and take a look at the note 161053.

Best regards
Stefan

Unfortunately the corporation has locked the logon pad, hence i can not edit the connection for high speed connection.

0 Kudos

That is brilliant Stefan. You are an amazing man.

That is identical pop up, but in English.

Do I write it like this below, to work?

Session.findByID("wnd[1]/usr/subSUBSCREEN_STEPLOOP.SAPLSPO5:0150/radSPOPLI-SELFFLAG[0,0]").press

I will try this tomorrow when back at work.

Thank ever so much.

stefan_schnell
Active Contributor
0 Kudos

Hello Savakis,

it could be possible that it works with the same ID, but I don't know it. Please take a look at your LAN Speed Connection and let us know what your setting is. If it is set to low, set it to high and record your actvity again.

Best regards
Stefan