Interface XbpWork


  • public interface XbpWork
    Unit of work, uses the XBP interface
    Selection of SAP jobs using selectJobs:
    
      {
        import com.redwood.scheduler.api.connector.sap.rfc.scripting.RfcConnectionManager;
        import com.redwood.scheduler.api.connector.sap.rfc.scripting.xbp.XbpInterface;
        import com.redwood.scheduler.api.connector.sap.rfc.scripting.xbp.XbpJobSelectionOption;
        import com.redwood.scheduler.api.connector.sap.rfc.scripting.xbp.XbpJob;
        import com.redwood.scheduler.api.connector.sap.rfc.scripting.xbp.XbpWork;
        import com.redwood.scheduler.api.model.enumeration.SapBatchJobStatus;
        import com.redwood.scheduler.api.model.SAPSystem;
        import com.redwood.scheduler.api.date.DateTimeZone;
    
        import java.util.Iterator;
        {
          SAPSystem sapSystem = jcsSession.getSAPSystemByName("NSP");
          RfcConnectionManager rfcConnectionManager = new RfcConnectionManager(sapSystem);
    
          rfcConnectionManager.callXBP(new XbpWork()
          {
            public void performWork(final XbpInterface xbp)
            {
              SapBatchJobStatus[] statuses = new SapBatchJobStatus[]
              {
                SapBatchJobStatus.Scheduled, SapBatchJobStatus.Finished
              };
              DateTimeZone dtz = new DateTimeZone();
              dtz.truncateHour();
              Iterator<XbpJob> jobs = xbp.selectJobs(XbpJobSelectionOption.All, "*", null, statuses, dtz, new DateTimeZone() );
              jobs.forEachRemaining(job ->
              {
                jcsOut.println("SAP job #" + job.getJobcount() + " named '" + job.getJobname() +
              "' has " + job.getNumberOfSteps() + " step(s).");
              });
            }
          });
        }
      }
    
     
    • Method Detail

      • performWork

        void performWork​(XbpInterface xbpInterface)
        This method is called with an established RFC connection
        Parameters:
        xbpInterface - XBP interface