Using Optimization PeopleCode in an Application Engine Program
When you write an optimization PeopleCode program in an Application Engine program and you schedule it in PeopleSoft Process Scheduler, you must set the process definition with a process type of Optimization Engine. Other process types do not allow optimization PeopleCode in Application Engine programs.
While using optimization PeopleCode in Application Engine programs, make sure data is committed before calling the CreateOptEngine optimization function and the following OptEngine class methods:
Note: You can call the PeopleCode functions CommitWork and DoSaveNow within a step to save uncommitted data to the database before calling the listed functions and class methods. Keep in mind that forcing a commit on pending database updates is a serious step; it prevents roll-back on error. CreateOptEngine, ShutDown, InsertOptProbInst, and DeleteOptProbInst calls modify the database, so take care when terminating the Application Engine program without committing the changes made by those calls.