cancel
Showing results for 
Search instead for 
Did you mean: 

IF-statement in Personas that is checking if control is inactive?

Former Member
0 Kudos

Hi,

I have this simple script in screen personas that is clicking the option: "Attachment list". Everything is working great if there is attachments.

If there are no attachments the option is "inactive" or "greyed out". This will result in a script error.

I thought this was going to be an easy fix by adding IF statement to the the script. But howerver I specify the critera for the IF statement the script will always try to click the Attachment list. The condition will simply always be TRUE.

Am I missing something here or is it not possible at this time to script an IF statement that is checking if the control is inactive or similar?

Best Regards,

Oskar Söderlund

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

The only test you have at the moment is if the control exists. Whether the "Attachment list" menu item is active or inactive, it does always exist, and so that test will always be true as you have discovered.

I'm not aware of a way of testing the active/inactive status of a menu item.

Former Member
0 Kudos

Yeah unfortunately that is the case.

Now the end user will receive a personas script error popup instead of an informative text label saying that there is no attachments for that equipment.

Former Member
0 Kudos

There is another way, but it will get a little tricky.

Outside of the transaction IE03 you can check for the existence of attachments for a piece of equipment by looking in table SRGBTBREL. Field TYPEID_A will be "EQUI" and field INSTID_A will be the equipment number, zero-padded on the left to 18 characters long. Use SE16 to look in the table and you'll get the idea.

You could wrap this test in an RFC-enabled ABAP function and call that from your Personas script button. Use the return value from that RFC to decide if attachments exist or not and how the script should respond. Details for how to write such an RFC and call it from a Personas script are in this blog: .

Like I said, this isn't straightforward and perhaps Personas scripting should include an active/inactive test in addition to the exists/doesn't exist test. Until then, however, there is a way if you don't mind a bit of ABAP programming.

Answers (0)