Examples

An example of an on execute hook for the OnEvent() method, to illustrate the switch between using your own implementation and using the default behavior:

#pragma used dll oppmmmonevent		| my own on event handler

string	eventAction(50)

if not getControlAttribute(“eventAction”, eventAction) then
	dal.set.error.message(…)
	return(DALHOOKERROR)
else
	on case eventAction
	case “myEvent1”:
	case “myEvent2”:
		| invoke my own event implementation
		return( ppmmmonevent.myEventHandler(i.request, o.response, o.result) )
	default:
		| use the default behaviour
		io.default = true
		o.response = 0
		o.result = 0
		return(0) | OK
	endcase
endif

An example of an on execute hook for the OnEvent() method, to illustrate how to forward a request to another business object or method:

#pragma used dll oppmmmbl987sb00	| public interface of another business object

string	eventAction(50)

if not getControlAttribute(“eventAction”, eventAction) then
	dal.set.error.message(…)
	return(DALHOOKERROR)
else
	on case eventAction
	case “approve”:
		| use change method of the same business object
		… | at this point the control area in i.request must be changed to match the change method
		return( ppmmmbl123sb00.Change(i.request, o.response, o.result) )
	case “plan”:
		| send plan event to another business object
		… | at this point the business object must be renamed in i.request, see section 0
		return( ppmmmbl987sb00.OnEvent(i.request, o.response, o.result) )
	default:
		| use the default behaviour
		io.default = true
		o.response = 0
		o.result = 0
		return(0) | OK
	endcase
endif