1

I don't find the answer on the internet. When I open some orders in a transaction, I have sometimes a popup. I want to execute some code if this popup text is 'Consider the subsequent documents'. If it is another text, I will execute some other code.

Problem is, we use SAP in several languages (EN, DE, FR), so I can't just say "if text = 'Consider the subsequent documents'. I know each message has its own ID in SAP. I know how to find this ID manually (see screenshot below), but I can't access it with findById(), even using the Record and Playback tool, because it uses the Performance Assistant window, which is not a children of the SAP session (it's a separate application, see second screenshot).

How could I do?

enter image description here

enter image description here

If session.ActiveWindow.Name = "wnd[1]" Then 'There is a popup
        'Find message number (haven't find better way)
        session.findById("wnd[1]/tbar[0]/btn[1]").press 'Press "Info"
        'Line missing here to click the button in Performance Assistant Window. Record & Playback tool does not catch it.
        If session.findById("wnd[2]/usr/txtHELP_INFO-MESSAGENR").Text = "081" Then
            'Some code
        End If
        'close popups
        session.findById("wnd[2]").sendVKey 0
        session.findById("wnd[1]").sendVKey 0
End If
Eugène
  • 43
  • 6
  • So, we should understand that you are able to receive the popup window text. Is this understanding correct? If yes, and having only three languages it should be less complicated than launching Performance Assistant, programmatically pressing one button and then receiving the text of a control. It maybe will not be exposed by the application... But, according to the localization, you can set a `Boolean` variable for each language, place the message translation on three columns, in a hidden sheet and identify it only by popup text. – FaneDuru Jul 20 '21 at 06:44
  • At least, will "Performance Assistant" have the same title in all languages? If yes, you can try using APIs (FindWindow, FindWindowEx and SendMessage). Use Spy++ or a similar (free) application to see the windows tree and try finding the necessary handlers. – FaneDuru Jul 20 '21 at 06:46
  • Thanks for the comments, Yes I know how to get the text of the popup, I could then check if (for example) it is in an array containing all the translations for this particular text. I would really appreciate though having a "clean" "universal" solution using IDs and not displayed texts, a solution that I could use in future codes, in other companies. Interacting with the Performance Assistant window could be the solution yes (I don't know its name in other languages), but it is quite complex, therefore I asked here first if there is a better easier way. – Eugène Jul 20 '21 at 07:12
  • I found out that it is possible to display the Help in a Modal window (=Popup) rather than in a separate window Performance Assistant. Then it is possible with findById() functions to get the message number Popup raises > F1 > F9 > findByID(...).Text – Eugène Jul 20 '21 at 13:15
  • Good for you! I do not work in SAP (anymore)... Thanks for sharing. Maybe somebody else will be interested in this solution. – FaneDuru Jul 20 '21 at 13:18
  • Great that you have found a solution to your problem. Maybe you would like to help future visitors by explaining how you defined the Help to be displayed in a Modal window? (posting it as an answer). Thank you very much! – Sandra Rossi Jul 20 '21 at 15:20

1 Answers1

1

I found out that it is possible to display the Help in a Modal window (=Popup) rather than in a separate window Performance Assistant. Then it is possible with findById() functions to get the message number Popup raises > F1 > F9 > findByID(...).Text

To set the Help in a Modal window, the user must first (manually or programmatically) check a setting:

enter image description here

enter image description here

Eugène
  • 43
  • 6