使用SAP BO API重新触发计划的实例吗?

问题描述 投票:0回答:1

我想使用CMS上的Java jar文件重新触发所有失败的计划。

仅出于测试目的,我在下面的程序中编写了这个程序,我想它将重新触发某个计划,该计划已成功完成。

[请帮助我找出我在哪里出了问题,因为当我在CMS上运行此程序时,它显示成功,但是未触发计划

public class Schedule_CRNA implements IProgramBase {
 public void run(IEnterpriseSession enterprisesession, IInfoStore infostore, String str[]) throws SDKException {
  //System.out.println("Connected to " + enterprisesession.getCMSName() + "CMS");
  //System.out.println("Using the credentials of " + enterprisesession.getUserInfo().getUserName() );
  IInfoObjects oInfoObjects = infostore.query("SELECT * from CI_INFOOBJECTS WHERE si_instance=1 and si_schedule_status=1 and SI_ID=9411899");
  for (int x = 0; x < oInfoObjects.size(); x++) {
   IInfoObject oI = (IInfoObject) oInfoObjects.get(x);
   IInfoObjects oScheds = infostore.query("select * from ci_infoobjects,ci_appobjects where si_id = " + oI.getID());
   IInfoObject oSched = (IInfoObject) oScheds.get(0);

   Integer iOwner = (Integer) oI.properties().getProperty("SI_OWNERID").getValue();

   oSched.getSchedulingInfo().setScheduleOnBehalfOf(iOwner);
   oSched.getSchedulingInfo().setRightNow(true);
   oSched.getSchedulingInfo().setType(CeScheduleType.ONCE);
   infostore.schedule(oScheds);
   oI.deleteNow();
  }
 }
}
jar sdk sap business-objects business-objects-sdk
1个回答
0
投票

似乎您错过了将检索到的预定对象放入集合中的可能性。

摘要的最后一部分应该是:

oSched.getSchedulingInfo().setScheduleOnBehalfOf(iOwner);
oSched.getSchedulingInfo().setRightNow(true);
oSched.getSchedulingInfo().setType(CeScheduleType.ONCE);
IInfoObjects objectsToSchedule = infostore.newInfoObjectCollection();
objectsToSchedule.add(oI);
infostore.schedule(objectsToSchedule);
oI.deleteNow();

您不能直接安排报告,而是通过收集来安排。完整样本is here

同样,您的编码从存储库中删除对象,并在每次迭代时重新安排它的时间似乎很奇怪,但这取决于您的要求。

© www.soinside.com 2019 - 2024. All rights reserved.