cancel
Showing results for 
Search instead for 
Did you mean: 

SAP CPS Status handlers

former_member1244799
Participant
0 Kudos

Dear All,

We are using Build: M33.92 CPS version.

Could you please advise on the below scenario with final status handlers

I have job chain created with 3 steps

Step 1- (ON ERROR : GOTO: STEP 3)

Step 2- ON ERROR: Continue

Step 3

If all the steps in the chain executes completely then the final status of the chain is "Completed" (which is normal)

However if step 1 and step 2 got errored and step 3 is successful, the final status of the chain shows as "Completed" .How can we make the chain as errored, if any step of the job chain errors?

In Default status Handlers I defined with and with out the below condition but still same issue.

On Error: Raise error

Can anyone please advise, the appropriate conditions maintained in the default and final status handler or any other configurations.

Thank you in advance.

Regards,

Ramana

Accepted Solutions (1)

Accepted Solutions (1)

nanda_kumar21
Active Contributor
0 Kudos

You have to write a post-running action to check the child jobs' status and then set the Job Chain status.

thanks

Nanda

former_member1244799
Participant
0 Kudos

Thank you so so much Nanda. I used the below post running action from the admin guide.

{
//Check if the first step failed, if it did,
//throw an exception to put the Jobchain job into Error

String stepName = "Step 1";
String statusName = "Error";

// Get an iterator over the child jobs of the job chain job

for (Iterator it = jcsJob.getChildJobs(); it.hasNext();)
{
Job myJob = (Job)it.next();
String realStepName = (String) myJob.getDescription();
String realStatus = (String) myJob.getStatus().name();
if (stepName.equals(realStepName) && statusName.equals(realStatus))
{
throw new RuntimeException();
}

}
}

Regards,

Ramana

Answers (0)