Skip to Content
0

SAP CPS Script | Try - Catch (Error Handling)

Feb 10, 2017 at 08:36 AM

104

avatar image

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();
}
}
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

0 Answers