How to handle SAP automation freeze and robot freeze

I have built sap automation process and sometimes the SAP screen freeze and robot freeze as well, so i added timeout in sap process workflow but that timeout never works unless i open the robot machine and kill sap from task manager.
The below link explains about the same issue under Error Handling, but i am not sure how to implement this.

Can someone provide me the solution for this please?

1 Like


Did we try with this method as per the same document

Therefore, all interactions with SAP should be timeboxed and put in a Parallel activity, that has a delay with the expected running time and an action like closing the SAP process.

Where we can use parallel activity with the sequence of activities you have, which can placed in left side of that activity and another sequence of activities to close SAP, at right side of parallel activity

This will the bot to run asynchronously and perform the task one next to another

Cheers @anto.santhosh

Yes, what can I check in parallel, checking element from sap might not work if its freezed, just adding delay in parallel also wont work since my work flow might complete in a sec or it takes 10 min depends on the input.

It’s pretty simple

In the sequence where you have activities for sap navigation use the below loop at the place where you face this issue

  1. Use a assign activity like this

counter = 0

Where counter is a int32 variable

  1. Then use a DO WHILE activity

  2. Inside the loop use a ELEMENT EXISTS activity and indicate the element in sap that you feel would come after the freeze time

  3. Get that output as bool_exists

  4. Now use another assign activity inside the loop like this
    counter = counter + 1

  5. Then use a delay activity inside the same loop like this

Finally with the condition part of do while mention like this

counter < 50 AND NOT bool_Exists

If this condition doesn’t satisfies it will get out of loop which means freeze has gone and bot is ready to act on SAP

  1. If it goes beyond the counter then it goes to the next sequence in parallel activity

Cheers @anto.santhosh

I want the below workflow “Create PO” to be processed it might take 1 sec to 10min to process based on number of items. Now the freeze happens inside this workflow at any stage. So if i put this inside the parallel activity and in parallel if i put that do while loop will it work? I am not sure at what stage to do element exist since the sap screen will remain same for each queue item.

Yeah it should be because we are counting at the wait time with a counter variable and we are not only using element exists

And use the above sequence at the place where you anticipate for that freeze

Cheers @anto.santhosh

This works, but since we give 5 sec delay and 50 counter it will take around 4 min(we dont know exactly how long it will take for actual process) to process the parallel activity and to move to next queue item while my actual sequence would have completed even before that so it will be a waste of time right?

Then we can reduce the delay and counter accordingly you want

As simple as that

Cheers @anto.santhosh

That’s the main problem here, one purchase order might have 1 line item and another purchase order might have 100 line items.
And we have huge volume of data to process so we cant waste even a single second.
Isnt there a easy way to find out sap is frozen or not?

Yeah I understand
To standardise the process we need to have ideal time considering all the possibilities
So based on that have the time set
Either it surpass that time or gets picked within that time has to be standardised and mentioned to the users
That’s the main part of process standardisation
So I think it’s fine to have this


Actual problem here is workflow time out is not working. Cant UiPath fix this issue?

use my snippet

it contains the parallel activity and timer where you just put in the time in seconds

just put your SAP process flow in the right sequence and set the timeout in the left sequence (instead of adding timeout in workflow properties)

If I put a specific flow like create purchase order and it was completed before the timeout for example 2min, will the bot wait for two min to complete and close SAP for every transaction?
Can we just skip the timeout workflow once my flow is completed?

Wait ill send you a new workflow

SAP Timeout (5.2 KB)
sorry, use this one, It wont wait the whole duration once the sap flow is done


Or we can just give Boolean condition in parallel activity once my work flow is done and set condition to true it will come out of parallel activity.
Thank you very much Jack and Palaniyappan for your help

1 Like

yes i did something similar in the new zip i sent u

but instead of boolean i used a text file, after the sap flow robot will create a text file to indicate Flow complete, if the timer flow sees this text file it will stop as well

Yes this or Boolean condition will work, Thank you.

Well I am facing different issue now, whenever the SAP freeze and timeout is reached in parallel after killing the SAP and throwing system exception, the job is getting faulted instead of moving to next queue item.
Usually when system exception happens we have set to one retry, but retry not happening in this case.