Handilig a SAP Logical Error

I am trying to build a SAP automation. I would like to know how to handle a SAP Logical Error. If I have a logical error on SAP application, there will appear the error message like this;


If I could able to check there error MSG field existing or not, I could decide next action. If there is not a SAP Logical Error, that error MSG field is not existing. I would like to check existing “[CLASS:GuiStatusbar;NAME:sbar.smsg]”. Many Thanks.
Best regards,
Shigeki Haiwara

Hi @s_hagiwara is the icon saying that there is an error always the same?

image

If it is - you could use Wair for image action to look for this icon on the screen.

Also, can you share the details of this element (the right panel in the Inspector)?

1 Like

Dear Alesia-san

Thank you for your response and for your a lot of support.
I think the Logical error msg icon may be always the same. Sure !, I understand Wait for image action is helpful for checking this message.
I will attach the right pannel in the Inspector.


Many thanks.
Best regards,
Shigeki Hagiwara

Dear Alesia-san

I am sorry I informed miss information. There was another Error msg icon.
Error%20Icon
I think there may be two type. Is the bot is able to read inforamation of right pannel of Inspector within executing? Because I want to retrieve Error mssages. But it is not capable to use OCR in Studio, because now the OCR in Studio is not able to recognize Japanese symbols.

Many thanks.
Best regards,
Shigeki Hagiwara

Is there such element ([CLASS:GuiStatusbar;NAME:sbar.smsg]) on the window if everything is fine and there is no error?

If it appears only if there is some issue, you can use the following custom script to catch it

@CustomScriptAction(
        output = 'alert_message'
    )
 
    def CustomScript() {
if ($$("[CLASS:GuiStatusbar;NAME:sbar.smsg]").size() > 0) {
alert_message = RBoolean.of(true)
    }
    }

Then you can read the text of the element using this script from the Knowledge Base
https://kb.workfusion.com/display/RPAe/Code+Samples#CodeSamples-GettingobjectvalueYellowWorkFusion

1 Like

Dear Alesia-san
Thank you for your early response. If any SAP logical errors are not, the element ([CLASS:GuiStatusbar;NAME:sbar.smsg]) will not appear. I am very glad you to have thought of Custom Script. Many thanks ! I will try it.
Best regards,
Shigeki Hagiwara

1 Like

Dear Alesia-san

Thank you for your a lot of support.
I executed this Custimer Script. The content of aleart_message that was retrieved was ‘true’ . But I wants to get the ‘Text’ of [CLASS:GuiStatusbar;NAME:sbar.smsg]".


Perhaps, I think it may be solveed by changing field name of this part in Custom Script.
“alert_message = RBoolean.of(true)”
Please let me know what I should do. Many thanks.
Best regards,
Shigeki Hagiwara

You can get the text using the custom script from the Knowledge Base I shared above.

You just need to combine the 2 scripts

@CustomScriptAction(
        output = 'alert_text'
    )
 
    def CustomScript() {
if ($$("[CLASS:GuiStatusbar;NAME:sbar.smsg]").size() > 0) {
alert_text = RString.of($("[CLASS:GuiStatusbar;NAME:sbar.smsg]").getText())
    }
    }
1 Like

Dear Alesia-san

Thank you for your response and apologize my late reply. I am very thanks for your solution.
Many thanks.
Best regards,
Shigeki Hagiwara

1 Like

Thank you @s_hagiwara :slightly_smiling_face:

Let me know if this solution doesn’t help

1 Like

Dear Alesia-san

I executed thsi Custom Script. But the error occured at thsi Custom Script.

Caused by: groovy.lang.MissingPropertyException: No such property: alert_text for class: Script48

Please let me know what I schould do.
Many thanks.
Best regards,
Shigeki Hagiwara

Have you created a string variable ${alert_text} in the variables panel?

1 Like

Dear Alesia-san

Thank you for your quick response.
I am sorry not yet. I will corect and re-run sooner.
Best,
Shigeki

1 Like

Dear Alesia-san

I am very thanks for you. I am sorry the variable was remained previous Custmer Script. It was run completely. I am very happy.
Many thanks for your a lot of support !.
Best regards,
Shigeki Hagiwara

1 Like