Raising & Handling exception in Work Flow


 

Post Summary: The post describes how to declare an exception in the work flow. Raising it and handling it. If the exception is raised in the work flow and not catched then the work flow status shows as error.

  • Exception defined in the work flow header.
  • Can be raised in process control step which is included in a BLOCK step in the work flow.
  • Can be handled in the BLOCK step.
  • Go to Tx- SWDD and create a Work flow and save. provide the name and description and Continue.

  •  Create a container element. Provide its name and description and click on properties tab.

  • Select import and export and continue.

 

  • In the step create a condition.

  • Provide step name and double click on the link to create a condition statement.

  •  Provide the condition and continue.

  •  Provide the step out comes and continue.

  •  So here we have two branches. Now go to the work flow header.

  • Create an exception type in the local events tab in the client dependent tab. Save and Back.

  •  As per the condition we have a not initial and initial path.  In the initial path, Create a Block Step.

  •  Provide the step name and continue.

  •  Here we have a block.

  • Inside the BLOCK create a process control step.

  • Provide step name, outcome name. Function as Throw Exception and name of the exception as NULL_EXCEPTION that we already defined in the header of the work flow. So now if in the condition the value of the container parameter is null then it raises an exception.

  •  Activate the work flow and test.

  •  Provide the container parameter value as X and run.

  •  Check work flow log.

  •  The work flow successfully executed.

  • Here in the wf trace. Go back.

  •  Now again run the work flow with element value as null.

  •  check the wf log.

  •  Here the WF status is error. Because the exception is raised in the process control step inside the block which is not handled.

  • So here is the raised exception trace details.

  • Now go back to the work flow and we have to catch the exception now in the block it self. Now double click on the block.

  • Go to the Exceptions tab. here already the defined exception NULL_EXCEPTION is present that we have defined in the WF header.

  • Activate the exception and continue.

  •  Activate the WF and test.

  • Run.

  •  Check the log.

  •  
  • Check the tarce.

  • Here the exception is raised process control and catched in the Block. Go back.

  • Check the work flow contents.

  • Here also we can find the details of the raised exception.

  • To know about the exception handled path, in the exception handled path as shown create a send mail step.

  •  provide titile and body and continue.

  • Here is the way how the exception is handled when the exception is raised in the process control step inside the block step.

  • Check the Tx- SBWP.

  • test the WF.

  •  Run the work flow.

  •  Here is the mail.

  •  Check the work flow log.

  • Check the trace.

  • This is how the trace with raising the exception and handling it.

  • Check the run content.

  •  Here is the details about the raised exception.


 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s