Quantcast
Channel: SCN : Popular Discussions - SAP Business Process Automation by Redwood
Viewing all articles
Browse latest Browse all 1466

SAP CPS add parameter to all jobs

$
0
0

Hi All,

 

I am trying to add a job definition parameter "JCS_USER"  to jobs of type "CMD" using the below script. But it gets errored if "JCS_USER" already exists for the jobs. Could you please help how to check in the code if the parameter already exists, if the parameter don't exist...add the parameter.

 

 

{

      String query = "select JobDefinition.* from JobDefinition where BranchedLLPVersion = -1";
      for (Iterator it = jcsSession.executeObjectQuery(query, null); it.hasNext();)

{
       JobDefinition jobdef = (JobDefinition) it.next(); 
      if (jobdef.getJobDefinitionType().getName().equals("CMD"))
      {
                  
        JobDefinitionParameter User = jobdef.createJobDefinitionParameter();
      
        User.setName("JCS_USER");
        User.setDefaultExpression("=Table.getColumnString('System_Variables', 'JCSUSR', 'SystemValue')");
       User.setDisplayOrder(new Long(30));
       User.setDirection(ParameterDirection.In);
       User.setDataType(ParameterType.String);
       jcsOut.println("Param2" + User.getName());
            jcsSession.persist();       

     }
    }

}

 

Thank you in advance,

 

 

Regards,

Ramana


Viewing all articles
Browse latest Browse all 1466

Trending Articles