[Resolved] Simulated typing/clicking not always supported for nearly identical UiElements in the same SAP transaction

Hi there,

I’ve been looking on the Forums searching for people with the same problem I’m currently facing, but so far I have yet to see a post with the exact same situation or a solution that did the trick for me as well. Apologies if I did somehow miss a topic that covers my current roadblock.

I’m currently working on a script that enters data in the MIRO transaction in SAP. The data gets fetched from an XLS file and afterwards the script writes the data in different input fields in the SAP transaction. I’ve tested the entire process a few times successfully with the input mode of the SAP application scope being set to Hardware events.

As I was nearing the point of being fully satisfied with the current build of my script I wanted to make sure I would be able to run it in the background. I read in the documentation for that to be possible the input type of all my “Click” and “Type into” activities needs to be set to Simulated. Hence I changed the input mode of the entire SAP application scope to Simulated and I made sure to adapt for any warnings the script gave me after making the change (I had to remove the “click before typing” in a few of my “Type into” activities as UiPath gave the warning that this is only possible for activities with Hardware events as the designated input mode).

Everything seemed fine but once I pressed Debug file I was met with the error below:

image

At first I thought maybe this specific transaction just doesn’t support simulated input mode, maybe it’s just the way I built the script. However, once I put that specific activity on input mode Hardware events and I kept the rest of the application scope on input mode Simulated, all the other activities accepted simulated typing/clicking and the script ran successfully.

So now I have a script that works for just about 95-99% on simulated input mode, yet there is a single activity that does not want to support it. The part I don’t understand is that this specific activity is in the same transaction as the majority of the other ones I use in the script, it is an input field like all the others and it is executed in the same sequence of activities as the other UiElements. Even the descriptors look very alike, the only difference I can see is the actual ID of the element in the SAP transaction.

I’ll add some screenshots to visualize my case.
Below: 2 UiElements that are almost the same, they both have to type something in a certain field in SAP. Activity 1 gives an error when using Simulated typing, but activity 2 is OK.
I pasted them both in the UiExplorer to see if there were any inherent differences but they’re nearly identical apart from the actual ID of the field.


Because the two descriptors are so similar, I feel like it’s not that specific field that is giving me the error. Am I forgetting something else? I should add that between opening the SAP transaction the XLS file is also invoked as well as a for each activity before it starts typing in the SAP fields. I tried adding a focus activity before the “Type into” activity that returns the error, but that didn’t change the outcome.

I’d appreciate any advice I can get. I’m pretty new to working with Studio so I might just be forgetting something basic, but I can’t seem to figure it out by myself. :slight_smile:

Thanks in advance and kind regards!

1 Like

Hello @HERRYGERS_Wouter,

I’ve looked into the scenario described, and for the element indicated I managed to run it successfully using UIAutomation.Activities v22.4.6:

The only difference I noticed is that for the Empty field before typing activity property I had used Single line instead of Multi line. I ran the same workflow using Multi line and then managed to reproduce your issue:

We will look into it, check the expected behavior and come back with an answer, but for now, please let me know if it works by changing the value to Single line.

As a side note, regarding how “alike” the elements really are, however similar they seem by looking at the selector, if you use the Property Explorer area of the UiExplorer, you will notice that the Reference field is a GuiTextField type while the Invoice one is a GuiCTextField SAP WinGUI control. :grin:

Happy automating!

I think you can disregard the above reply, it seems to be related to the data you are actually entering in this type of control. This calendar select control

expects valid date format values, if you try manually entering a date such as 33/33/9999 SAP will highlight the field and display Invalid date on the status bar. Doing the same with the Type Into activity with Simulate will always throw the error.

When you are not using simulate for this specific control, does the field turn red as well? Also please let me know which version of UiAutomation.Activities you are using.

Thank you,
Stefan

Hi there Stefan, many thanks for getting back to me so swiftly!

I’ve tried doing what you described in the first reply by changing the ‘Empty field before typing’ mode from Multi line to Single Line. Somehow on one of the runs it seemed to have worked, but when I re-tested it to be sure it threw the same error whilst the Empty field setting was set to Single line. So alas, no avail just yet!

image

I did indeed notice the small difference between the two fields, one being a GuiTextField and the other a GuiCTextField in the descriptor. I’m not sure if that is going to be the reason as to why the Invoice Date field is throwing that error, but at this point I wouldn’t know what could be the reason either. :slight_smile:

When I am not using simulate for this specific control, the field does not turn red. When I use ‘Hardware events’ as the input mode the control gets filled with the correct details. I’m not opposed to using ‘Hardware events’ as the designated input type for that control, but it would be the only control in the entire process that requires it. It just didn’t feel entirely right that it just doesn’t work on Simulate.

Perhaps the reason is that my UiAutomation.Activities version is outdated? I’ve checked just a minute ago and I do seem to be a few versions behind yours, mine is currently on 21.10.5.
Is this something I need to frequently update manually or can I enable a certain setting that tries to update to the latest version of activities when available?

image

Many thanks and have a nice weekend! :slight_smile:

Wouter

Hello Wouter,

You are right, if it works with hardware events, it should work the same when using simulate and we will get to the root of this issue. :face_with_monocle:

We generally recommend updating to the latest version since every new release is packed with new features and stability fixes, but in your case 21.10.x is the latest LTS version released so it should be fine!

I created a workflow using UiAutomation.Activities v21.10.5 in which generated random dates and inputs with simulate (with the field empty and filled, both single line and multi-line empty field, and different date separators such as . and /). Everything seems to runs smooth as long as the data entered is valid. Towards the end of recording you can notice the workflow fails with the exact same error on the Reference field. The reason it does is because the field accepts a maximum of 16 characters and “IterationNumber10” exceeds that. It looks like a combination between SAP field limitations and poor details in the error mesaage your receive from our activities when they fail in this case.

Going forward I suggest you should use a Log Message activity and write CurrentPODataTableRow("InvoiceDate").ToString right before the Type Into + Simulate so we have a better view on the data to be entered when it fails.
Also to be extra-sure please let me know which version of SAPWinGUI you are using and which theme.

1 Like

Hi there Stefan,

Thank you for the example with the multiple iterations, that actually lead us to the explanation here. It looks like I am partially the architect of my own troubles here. Something I could have mentioned in the initial post was that I was deliberately testing all kinds of inputs in the different fields, so I could test whether the script was correctly capturing the errors SAP would have thrown if there was an error. When testing on Hardware Events it did that correctly, so I assumed (incorrectly) that this wouldn’t be the cause of the error when running the sequence with the Simulated input mode.

It just so happens that the first line of my dataset for testing purposes is one with an invalid invoice date in the format 01.01…2022, so I’m convinced that the reason why it fails immediately on the first line of my dataset is that the invoice date I’m trying to fill in exceeds the maximal number of allowed characters in the Invoice Date field in SAP. Had I sorted my dataset differently and would this line have been the sixth iteration, it would have at least done the five first ones correctly and I would have been looking for a line-specific issue instead of thinking it was something with the input mode itself.

The SAP field limitations, combined with the error message that also seemed to point in the direction of the SAP field not supporting that type of input mode, made me think it had something to do with the input mode, but in the end it’s just the restrictions on the SAP field itself. To be entirely sure I removed all invoice dates that exceed the SAP field character limit in the dataset and ran a few new tests. This time around everything seems to be working as intended so I’m positively convinced that this was the source of the problem.

To make sure my script won’t stop working due to a faulty invoice date I’ll add a preliminary check on the dataset that takes care of any dates that would exceed the SAP field character limit. Doing this I can safely keep the input mode on Simulated for the entire script, and I don’t have to worry about a faulty date interrupting the run as they will be taken care of before any data is going to be written into SAP.

So I think you have found the solution to this problem, it ended up being a mix of me setting myself up for failure trying to input data that exceeds the limitations of the respective SAP field, thinking it would work similary as the Hardware events input mode, together with the error message seemingly pointing us in another direction. :slight_smile:

Many thanks again for your help, I will go ahead and mark the topic as resolved. :+1:

If it can still be of any use: my SAP WinGui version is 7700.1.3.3397 / Build: 381393 / SAP Signature Theme

Kind Regards,

Wouter

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.