Get text in SAP system

Hello community,

I wanna check in SAP, if a specific field is empty or filled with text but I don’t have the correct solution yet, as it doesn’t recognize a text, even when it is filled.

image

How would you solve this problem? I already read about the solution String.IsNullorEmpty(value), but what is the step before?

Best regards
Flo

1 Like

Hi @FloN
What activities exactly did you use to get the value of textbox ?

cheers :smiley:

Happy learning :smiley:

3 Likes

Hi @pattyricarte,

the last try was the “Text exists” activity, but I already tried the Get text activity as well.
Maybe I used it the worong way.

image

1 Like

@FloN

Even Get Text activity you didn’t get any value at all ?

cheers :smiley:

Happy learning :smiley:

3 Likes

Hi
make sure SAP GUI is installed so that we would be able to select each and individual element in that application


and once after enabling this GUI
we can use GET ATTRIBUTE ACTIVITY and check with “text” or “aaname” attribute whether it is empty or with any value in it, get the output with a variable of type string str_output
–now use a IF condition and mentin this condition
String.IsNullOrEmpty(str_output.ToString)
if true it will go to THEN part or will go to ELSE part

or still if we are not able to identify the text we can use SCREEN SCRAPPING method in the design panel
–get the output with a variable of type string and check again with same IF condition

or we can choose this field with empty value in it as a IMAGE with IMAGE EXISTS activity and get the output with a boolean variable
image

if the field is empty this activity will give us true as output and use a IF condition to validate this
bool_variable = True
if true it will goto THEN part or to the ELSE part

hope this would help you
Cheers @FloN

1 Like

@FloN

Are you able to identify other elements in SAP Application ?

If you are not identifying any elements then I guess you didn’t install SAP script. Other alternative is to we can use Computer Vision activities or image activities to identify these kind of elements.

1 Like

I tried the get text activity again and it worked, but unfortunately the condition “if empty…” doesn’t work.

Can you see the mistake?

2 Likes

I used a write line to get the length of the string and it seems that there is always a space in this field, even when it is empty.

So i just had to adjust the condition to “… > 1”

Thank you for your help and the additional SAP GUI Scripting explanation @Palaniyappan

@FloN

Instead of checking length you can try this one.

    String.IsNullOrEmpty(SupplierName_exists)

This expression can be used in the IF block you have and str_output is the output variable from get text
cheers @FloN

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