ERP software have workflow support. Look at books that deal with implementing workflows in SAP or Siebel.
A workflow is a series of steps. Let us define what we can do in a step:
- Read data from a table/multiple tables
- Update/Delete/Create records in one or more tables.
- Update variables used in processing a workflow
We can refine a step into a series of atomic instructions.
You could look at the following basic entities
- Workflow Definition(Wid,Name,authId) (authid is a way to restrict who can run the workflow)
- Workflow Step(StepId, Wid, Name)
- Workflow instruction (InstrID, stepId, Type, SQLstmnt)
The above tables will be the static definition of your workflows. You need an identical set of runtime tables to store the results of each step of a workflow. Each of those tables will also have a flag to indicate whether the step/instruction completed or not.