How to add a step to a procedure of a task using OpenApi

Hi guys,
I want to add some steps to a procedure of a task.
For example consider i want to add a string object as a step in a procedure
how to do this ?
I know how to retrieve procedures and steps by the following lines :
IBPTask task = new IBPTask();
IBPProcedure allProcedures[]=task.toBpProcedureArray();
IBPProcedureStep allSteps[] = allProcedures[0].toBpProcedureStepArray();

but dont know how to make a new IBPProcedureStep object and add it to the IBPProcedure object.

some thing like this dont works:
IBPProcedureStep step= new IBPProcedureStep {
.
.
};
step.setName(“This is a step”);
procedure.addBpProcedureStep(step);

I found it.
we can add a step by this way :
IBPProcedureStep newStep=IModelElementFactory.instance().createBPProcedureStep();
newStep.setName(“new step”);
procedure.addBpProcedureStep(newStep);

1 Like