Skip to Content

VBA list each control on a pop up form

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.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

6 Answers

  • Best Answer
    Apr 18 at 07:07 AM
    -1

    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


    pivottable.jpg (49.2 kB)
    Add comment
    10|10000 characters needed characters exceeded

  • Apr 23 at 11:49 AM

    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.

    Add comment
    10|10000 characters needed characters exceeded

  • Apr 27 at 09:25 AM

    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
    Add comment
    10|10000 characters needed characters exceeded

    • 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

  • Apr 19 at 08:01 PM

    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.

    Add comment
    10|10000 characters needed characters exceeded

    • 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

  • Apr 24 at 03:00 AM

    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


    Add comment
    10|10000 characters needed characters exceeded

  • Apr 30 at 04:07 PM

    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.

    Add comment
    10|10000 characters needed characters exceeded