Skip to Content
avatar image
Former Member

SAP CPS Script | Try - Catch (Error Handling)

Hi,

is there a way to get the error handling to work? I am trying to update certain Jobparameters. Anyways sometimes a job does not even have that paramater for any reason. I have added my script which works fine if the Jobparameter exists.

{
JobDefinitionParameter jobdefparam;
for (Iterator it = jcsSession.executeObjectQuery("select JobDefinition.* from JobDefinition where Name like '//search//' and BranchedLLPVersion = -1", null); it.hasNext(); )
{
JobDefinition jobdef = (JobDefinition) it.next();
jobdefparam = jobdef.getJobDefinitionParameterByName("JOBCLASS");
jcsOut.print("Updated " + jobdef.getName() + ": " + jobdefparam.getName() + ": " + jobdefparam.getDefaultExpression() + " to ");
jobdefparam.setDefaultExpression("B");
jcsOut.println(jobdefparam.getDefaultExpression() + "(new)");
jcsSession.persist();
}
}
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

0 Answers