Exception Handling before Switch Flavor in Scripts for SAP Personas 2.0
I have created customized flavors for the transactions used by my client.
For this, I've created a unique flavor of SMEN which contains buttons directing to the other flavors (of different T-Codes).
My issue occurs when a user clicks on a button of the T-Code he is not authorized to use.
He gets a message of this form along with a ITS message at the bottom stating that the user is not allowed to use the Transaction:
I have added a 'Switch Flavor' command after the user is directed to the transaction.
I need to put an exception (using IF condition?) after the user is directed to the transaction but before the Switch Flavor is executed.
To summarise, my primary goal is to change the TEXT of this error message, possibly by raising an exception before Switch Flavor.
Steve Rumsby replied
You need to detect somehow that the transaction execution failed. There are a couple of obvious ways to do that:
- SAP will be issuing a "you don't have authority for this transaction" message in the status bar. You could detect that and take appropriate action.
- The user will also still be in transaction SMEN. You could look for screen elements on SMEN and of they exist you know the transaction execution failed. Or you could look for screen elements of the new transaction and if they don't exist you know the transaction execution failed. Either way, you can then take appropriate action.
The appropriate action would be to issue a message to the user and not try to do the flavour switch, I assume.