web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Automate
Suggested Answer

"If window" and SAP

(1) ShareShare
ReportReport
Posted on by 4
Hi,
 
I'm experiencing an issue with the usage of "If window" action.
 
My flow consists in looping through a material list and performing some actions in SAP.
At some point, I need to check whether a window called "Warning" exists or not, using the "If window" action.
The window does not have to appear for every material number.
 
When I start my loop and that window appears, it is properly identified by the "If window" action. That is good.
The problem occurs when the next material number is being processed, after the one that has triggered the "Warning" window.
 
The "If window" condition is always filled, even if the window does not exist. I do not know why this happens...
 
Does someone have an idea why the condition for the existing window is met, even if the window does not exist ?
 
 
Thank you in advance,
 
I have the same question (0)
  • mathiaskjeldsen Profile Picture
    224 on at
    Hey
     
    Once the first warning window pops up, do you do anything to it? Do you close it before continuing the loop?
     
    Best regards
    Mathias Kjeldsen
  • Suggested answer
    Riyaz_riz11 Profile Picture
    4,214 Super User 2026 Season 2 on at
    Hi,
     
    As you mention first it is working after 2nd iteration if not exist if it is going inside condition then you need to work on selector and  make a dynamic selector.
    You can also try with if windows contains action and pass the text.
    If I have answered your question, please mark it as the preferred solution. If you like my response, please give it a Thumbs Up.
    Regards,
    Riyaz
     
  • Suggested answer
    WillSG Profile Picture
    352 Moderator on at
    Hi CU06081340-0 I hope you are doing well.

    Based on my experience, SAP is quite tricky from time to time, and the issue that you are facing could be due to different scenarios, especially these 2 below:
     
    • Timing Issues: The window might take some time to appear, so the "If window" action might NOT be catching it in that moment.
    • Residual Window Handle: Sometimes, window handles or processes might remain in memory, causing the "If window" action to detect them.

    To resolve this, my recommendation is that you need to Add a Delay in the process to wait for the Warning window to appear.

    Prior to the action that you are using right now, you can utilize a “Wait for Window” Action, this is more dynamic than utilize a “Wait” Action set up for X number of seconds.

    Also, you can use the wildcard * before the keyword Warning, this well helps your code to look for any window that contains the Warning word.

    Finally, you can have a Fallback process in place in case that these steps above does not work.



    Please see the sniped Code below:

    WAIT (UIAutomation.WaitForWindow.ToOpenByTitleClass Title: $'''*Warning''' Class: $'''''' FocusWindow: True) FOR 5
    ON ERROR REPEAT 3 TIMES WAIT 2
    ON ERROR

    END
    IF (UIAutomation.IfWindow.IsOpenByTitleClass Title: $'''*Warning''' Class: $'''''') THEN
        # HERE GOES A "PRESSES A WINDOW BUTTON" Action
        Display.ShowMessageDialog.ShowMessage Title: $'''YOU ROCK!''' Icon: Display.Icon.None Buttons: Display.Buttons.OK DefaultButton: Display.DefaultButton.Button1 IsTopMost: True ButtonPressed=> ButtonPressed
    END
    **REGION FALLBACK PROCESS FOR WARNING WINDOW
    IF (OCR.IfTextOnScreen.TextOnScreenExistsWithWindowsOcr TextToFind: $'''Warning''' IsRegex: False WindowsOcrLanguage: OCR.WindowsOcrLanguage.English SearchForTextOn: OCR.SearchTarget.EntireScreen ImageWidthMultiplier: 1 ImageHeightMultiplier: 1 TextLocationX=> LocationOfTextFoundX TextLocationY=> LocationOfTextFoundY) THEN
        # HERE GOES A "PRESSES A WINDOW BUTTON" Action
        Display.ShowMessageDialog.ShowMessage Title: $'''YOU ROCK!''' Icon: Display.Icon.None Buttons: Display.Buttons.OK DefaultButton: Display.DefaultButton.Button1 IsTopMost: True ButtonPressed=> ButtonPressed
    END
    **ENDREGION



    Please let me know if it works, happy automating!

    If I have addressed your inquiry successfully, kindly consider marking my response as the preferred solution. If you found my assistance helpful, a 'Thumbs Up' would be greatly appreciated.
     
    Additionally, I offer specialized consultancy and development services leveraging PAD. If you're interested in exploring these services further, feel free to DM me, and we can initiate a discussion.

    Finally, here is my YOUTUBE CHANNEL please subscribe to my channel and connect with me on LinkedIn Profile.

    Kind regards,
     
    Will SG
    Founder & Director
    RAMSolutions
    www.ramscr.com

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 284 Super User 2026 Season 2

#2
trice602 Profile Picture

trice602 188 Super User 2026 Season 2

#3
11manish Profile Picture

11manish 144 Super User 2026 Season 2

Last 30 days Overall leaderboard