【问题标题】:How can I get the LastRunTime for a report using the Business Objects Web Services SDK?如何使用 Business Objects Web 服务 SDK 获取报告的 LastRunTime?
【发布时间】:2011-01-20 11:51:27
【问题描述】:

我正在使用 Business Objects Web 服务 SDK 来访问我们的 Business Objects 数据。我已经成功获得了一份报告列表,并从中找到了之前运行的报告的LastSuccessfulInstance。但是,我似乎无法填充 LastRunTime。当我在没有指定属性的情况下进行查询时,它返回为未设置,当我特别要求该属性时,我得到相同的结果。我查看了报告本身和实例,他们都没有这些信息。有谁知道我可以从哪里得到它?

这是我的代码(来自 SAP 的一个演示):

    var sessConnUrl = serviceUrl + "/session";
    var boConnection = new BusinessObjects.DSWS.Connection(sessConnUrl);
    var boSession = new Session(boConnection);

    // Setup the Enterprise Credentials used to login to the Enterprise System
    var boEnterpriseCredential = new EnterpriseCredential
                                     {
                                         Domain = cmsname,
                                         Login = username,
                                         Password = password,
                                         AuthType = authType
                                     };

    // Login to the Enterprise System and retrieve the SessionInfo
    boSession.Login(boEnterpriseCredential);


    /************************** DISPLAY INBOX OBJECTS *************************/

    // Retrieve the BIPlatform Service so it can be used to add the USER
    var biPlatformUrl = boSession.GetAssociatedServicesURL("BIPlatform");
    var boBiPlatform = BIPlatform.GetInstance(boSession, biPlatformUrl[0]);

    // Specify the query used to retrieve the inbox objects
    // NOTE: Adding a "/" at the end of the query indicates that we want to 
    //       retrieve the all the objects located directly under the inbox.
    //       Without the "/" Path operator, the inbox itself would be returned. 
    const string query = "path://InfoObjects/Root Folder/Reports/";

    // Execute the query and retrieve the reports objects
    var boResponseHolder = boBiPlatform.Get(query, null);
    var boInfoObjects = boResponseHolder.InfoObjects.InfoObject;

    // If the reports contains a list of objects, loop through and display them
    if (boInfoObjects != null) 
    {
        // Go through and display the list of documents
    foreach (var boInfoObject in boInfoObjects)
    {
            var report = boInfoObject as Webi;
            if (report == null)
                continue;

            if (!string.IsNullOrEmpty(report.LastSuccessfulInstanceCUID))
            {
                var instanceQuery = "cuid://<" + report.LastSuccessfulInstanceCUID + ">";
                var instanceResponseHolder = boBiPlatform.Get(instanceQuery, null);
                var instance = instanceResponseHolder.InfoObjects.InfoObject[0];

            }
        }
    }

report.LastRunTimeSpecifiedinstance.LastRunTimeSpecified 均为 false,LastRunTime 均为 01\01\0001,但我可以在 Web Intelligence UI 中看到上次运行时间。

【问题讨论】:

  • 问题,这段代码是用c#写的吗?因为它可能有助于将其标记为 c#。因为 C# 中的业务对象 sdk 的代码很少
  • @apereira:是的。我已经添加了标签。

标签: c# business-objects business-objects-sdk


【解决方案1】:

在 SAP 支持部门的 Ted Ueda 的帮助下,我想通了。默认情况下,并非所有属性都已填充,您需要将 @* 附加到查询字符串以获取所有内容,即更改行:

const string query = "path://InfoObjects/Root Folder/Reports/";

到:

const string query = "path://InfoObjects/Root Folder/Reports/@*";

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-06-10
    • 1970-01-01
    相关资源
    最近更新 更多