
In a Guided Procedures (GP) process you can create actions that handle exceptions raised by callable object execution. Additionally, you can choose a strategy to repeat or skip the activity that caused the exception.
See Creating Blocks .
To define result states, exceptions and other configuration parameters, use the IGPPhysicalCallableObject associated with the callable object. The physical callable object stores technical information about the object that should be invoked during action execution.
| Creating a Callable Object with Process Exception |
|---|
importcom.sap.caf.eu.gp.co.api.IGPCallableObject; importcom.sap.caf.eu.gp.process.dt.api.IGPDesigntimeUpdateManager; importcom.sap.caf.eu.gp.co.api.IGPPhysicalCallableObject; // create a callable object IGPCallableObjectco = manager.createCallableObject( coType, locale, coTitle, coDescription, cat.getID() ); // retrieve the physical callable object IGPPhysicalCallableObject pco= co.resolvePhysicalCallableObject(); // define one process exception "e" pco.addProcessException("e","E");// save and activate the object manager.save(co); manager.activate(co); |
For more information on how to create callable objects, see Creating Callable Objects .
| Inserting the Callable Object into Action and Block |
|---|
import com.sap.caf.eu.gp.process.api.IGPModifiableAction;import com.sap.caf.eu.gp.process.api.IGPModifiableBlock;// set execute callable object co to action a_2 a_2.setExecuteCallableObject(co); manager.save(a_2); // add a_2 to the block structure b.getModifiableStructure().addItem(a_2); |
For more information on how to create actions, see Creating Actions .
During process execution, the callable object that you created may raise a process exception. You need a mechanism to handle this exception. For this purpose you create an additional action, which determines the processing strategy and informs the user about possible problems.
This action is executed whenever such an exception is raised. Its implementation is standard:
| Creating an Exception Handling Action |
|---|
//define action for the exception handler IGPModifiableActionae = manager.createAction( locale, "ae", "ae description", cat.getID() ); // save and activate the action manager.save(ae); manager.activate(ae); |
| Setting the Exception Handler |
|---|
importcom.sap.caf.eu.gp.process.api.IGPModifiableBlockStructureItem; importcom.sap.caf.eu.gp.process.api.GPExceptionHandlingStrategy; // retrieve block structure item of action a_2 IGPModifiableBlockStructureItemia_2 = b.getModifiableStructure().getModifiableItem(1); // create exception handler on ia_2 ia_2.setExceptionHandler("e",GPExceptionHandlingStrategy.STRATEGY_CONTINUE, ae); |
The example above also specifies the processing strategy after the exception handling action has been executed. The strategies you can choose from are:
STRATEGY_CONTINUE
STRATEGY_REPEAT