Help needed to terminate SAP long execution

Hi! I am trying to automate SAP GUI report extraction process but some of the reports are huge and takes >15 mins to load (15mins before anything shows up on the SAP GUI status bar. meanwhile i could only see the bar keeps running on the top of the screen). i would like to terminate the job and move on to the next extraction request if any report takes >1 minute (for testing purpose) to finish running.

I used a SAP Select Menu Item activity > Execute and set the timeout property of this to 60000ms but it did not terminate the job after a min. – SS1

i have also tried putting ‘read status bar’ activity inside a do while for it to loop for a minute before termination but it didnt work either. --SS2

how can this be achieved, please?

SS1

SS2


image

Hello @ellie.liu ,

Try this method,

Step 1 : After you select the menu item in SAP, add the delay activity.

Step 2 : Read or verify the status bar using classic activities like images exists or element exists and configure that to verify execution is still going on, element or Image exists return a boolean variable.

True : Still Executing
False : Execution completed.

Step 3 : use an if condition with the boolean variable returned from above step as condition,

Then : Transaction is still Executing,

Kill the execution using click or by passing hot keys.

Else : Transaction loaded, next steps.

Hope this helps you solve the challenge you are facing.

Thanks,
Gautham.

Hi Gautham,

The bot won’t move to the read status bar step after i click execute if the SAP is still loading.
May i check what is the delay activity for?

hi @ellie.liu

you can use “wait attribute” for SAP Screen loading .

please find the below thread for reference.

Hope it helps!!!

Hi Baskar,

I would like to terminate the job after 1min if SAP is still loading.

Hi @ellie.liu

please find the below thread.

Hope it helps!!!

Hi @ellie.liu ,

Delay activity is what i suggested instead of time out.

To illustrate lets say you are using a click activity with time out configured the functionality of time out is to wait for the mentioned time before throwing exception if click is not successful.

Whereas delay will help you wait post the click if you add seperately.

Also if the bot seems to be freezing thats coz the application you are interacting with is actively executing.

Try using a parallel container, in left half keep the menu item selection and in the right half add a delay and the rest steps suggested in the first post this would help you out.

Since you would be making use of parallel activity consider adding some 20 or more seconds so that click is executed and 1 min wait time is there.

Thanks,
Gautham.

Hi @ellie.liu

You can use the Element exists to check if the report is completed in one min or not, This element could be something that indicates the completion of the report extraction process.

Use the “Delay” activity to add delay of 1 min before this element exists. The output of element exists we can use it in if condition, if not exists we can terminate the execution as follows.

By using this technique it will not kill your whole SAP session.

image
Flow-

Hope this helps :slight_smile:

@ellie.liu,

To Achieve this, you will have to combine Parallel activity and Terminate workflow. Also you will have to use one intermediate workflow.

Sample Code:

Greeting Bot.zip (15.1 KB)

Thanks,
Ashok :slight_smile:

Hi Gautham,

I’ve set the do while to stop after 2 min but it does not exit the loop even after 2min

Hey Ellie,

Just Saw your Post,

Instead of the current method you are using to wait for 2 minutes.

Remove the loop, Use a delay activity to wait for 2 minutes directly it should looking something like

Delay - Element Exists → Log message → IF Condition (From the screen Shot)

Thanks,
Gautham.

Hi Gautham,

thanks for your help.
I’m using a for each row and i dont want the bot to wait through the delay for every row.
instead, i would like the bot to look for the element > log message > if exists then move to the next step else loop back to look for the element. this looping to look for the element should not exceed 10mins (for example) > if element do not exist after 10mins, send error message.

Hi @ellie.liu ,

Try modifying this way with the looping method

Before loop initiate a TryCounter of type int32 with count as 1

Do while Loop

Body :

Element exists to check if it is loaded
If condition
Loaded - Next steps

Else

Delay activity ( configure for 2 minutes)

Outside the if condition

Increment the Try Counter by 1.

Condition of while

TryCounter < 6

This will be executed 5 times wait time will be 10 minutes.

Add the same element exists activity after the loop

Check with if condition,
Else part
Throw the exception or log the message not loaded after 10 minutes.

Hope this works for you.

Thanks,
Gautham.

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