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

SAP CPS replace parameter value of all job definitions of type CMD

$
0
0

Hi All,

 

I am using the below Redwood script to update the parameter "DIRECT" of job definition "FILE_RENAME_PARAM". I am getting the parameter value from "PARAM_TRANSLATION" table. The column in the table is "TARGET". Can you please advise how can I change the below script to update the parameter "DIRECT" of ALL job definitions of type "CMD" using the below Redwood script.

 

 

{
     
      JobDefinition jobDefinition = jcsSession.getJobDefinitionByName("FILE_RENAME_PARAM");
      if (jobDefinition.getName().equals("FILE_RENAME_PARAM"))

      {
        JobDefinitionParameter parameterDIR = jobDefinition.getJobDefinitionParameterByName("DIRECT");
      
        if (parameterDIR != null)
        {
          String defaultExpression = parameterDIR.getDefaultExpression();
          if (defaultExpression != null)
          {
            Table table = jcsSession.getTableByName("PARAM_TRANSLATION");
            if (table != null)
            {
              TableValue tableValue  = table.getTableValueBySearchKeySearchColumnName(defaultExpression, "TARGET");

              String targetInstance  = null;

              if (tableValue != null)
              {
                targetInstance  = table.getTableValueBySearchKeySearchColumnName(defaultExpression, "TARGET").getColumnValue();
               jcsOut.println(targetInstance);
                parameterDIR.setDefaultExpression(targetInstance);
               jcsSession.persist();

               
              }
              else
              {
                throw new Exception("Key " + defaultExpression + " (from job definition " + jobDefinition.getName() + ") was not found in table PARAM_TRANSLATION");
              }

   
 
                             
            }
          }
        }
      }
    }

 

 

Thank you so much in advance.

 

Regards,

Ramana


Viewing all articles
Browse latest Browse all 646

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>