为什么无法将IInfoStore对象转换为IDestinationPlugin?

2020-09-15 11:43发布

点击此处---> 群内免费提供SAP练习系统(在群公告中)加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)嗨, 我使用的是BO 4....

         点击此处--->   EasySAP.com群内免费提供SAP练习系统(在群公告中)

加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)


嗨,

我使用的是BO 4.0,并且想使用.copyToPlugin(),但是Cast无法正常工作。

我的代码是:

第1行)IDestinationPlugin destPlugin =(IDestinationPlugin)boInfoStore.query("从ci_parentId = 29和si_name ='CrystalEnterprise.SMTP'"的ci_systemobjects中选择*); 第2行)boDestination.copyToPlugin(destPlugin);


发生以下异常:

com.crystaldecisions.sdk.occa.infostore.internal.InfoObject无法转换为com.crystaldecisions.sdk.occa.infostore.IDestinationPlugin

是否可以修复它?

先谢谢您

拉法

7条回答
能不能别闹
2020-09-15 11:54

此代码段可帮助您了解带有选项的目标插件。
https://help.sap.com/查看器/0225aa3e7b4b4b17b2d4a882e6f2de96/4.2.6/zh-CN/45a5375d6e041014910aba7db0e91070.html

 public void configurePublicationDestination(IEnterpriseSession enterpriseSession,String publicationName)抛出SDKException
 {
   IInfoStore infostore =(IInfoStore)enterpriseSession.getService(" InfoStore");

   字符串publicationQuery =" SELECT SI_ID,SI_PROCESSINFO,SI_SCHEDULEINFO"
     +"来自CI_INFOOBJECTS的SI_PUBLICATION_DOCUMENTS"
     +" WHERE SI_KIND ='" + IPublication.KIND
     +"'AND SI_NAME ='" + publicationName +"'AND SI_INSTANCE = 0";
   IInfoObjects出版物= infostore.query(publicationQuery);
   IPublication发布=(IPublication)publications.get(0);
        
   字符串pluginQuery =" SELECT *从CI_SYSTEMOBJECTS,其中SI_PARENTID = 29 AND"
     +" SI_NAME ='" + IManaged.PROGID +"'";
   IInfoObjects插件= infostore.query(pluginQuery);
   IDestinationPlugin inboxPlugin =(IDestinationPlugin)plugins.get(0);
        
   ISchedulingInfo scheduleInfo = publication.getSchedulingInfo();
   IDestinations目的地= scheduleInfo.getDestinations();

   IDestination inboxDestination = destinations.add(IManaged.PROGID);
   inboxDestination.setFromPlugin(inboxPlugin);
   inboxDestination.setDeliverPerUser(true);
        
   收集文档= publication.getSchedulableDocuments();
   迭代器documentIter = documents.iterator();
        
   while(documentIter.hasNext())
   {
     IInfoObject文档=(IInfoObject)documentIter.next();
     整数documentID =新的整数(document.getID());
            
     IDestinationFormat格式= inboxDestination.getDestinationFormats()。add();
     format.setSourceDocumentID(documentID);
     IFormatInfo formatInfo = format.getFormatInfos()。add();

     formatInfo.setSourceDocumentKind(document.getKind());
     formatInfo.setFormat(document.getKind(),IReportFormatOptions.CeReportFormat.PDF);
            
     IProcessingPublicationInfo processingPubInfo =(IProcessingPublicationInfo)publication.getDocumentProcessingInfoObject(documentID);
     IInfoObject reportDoc =(IInfoObject)processingPubInfo;
     formatInfo = processingPubInfo.getFormatInfos()。add();

     formatInfo.setSourceDocumentKind(document.getKind());
     formatInfo.setFormat(document.getKind(),IReportFormatOptions.CeReportFormat.PDF);
     publication.setDocumentProcessingInfo(documentID,document.getKind(),
     reportDoc.getProcessingInfo()。properties());
    }

    publication.save();
 } 

一周热门 更多>