Как получить LastRunTime для отчета с использованием SDK Business Objects Web Services? - PullRequest
2 голосов
/ 20 января 2011

Я использую SDK Business Objects для доступа к нашим данным 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.LastRunTimeSpecified и instance.LastRunTimeSpecified ложные и оба LastRunTime являются 01\01\0001, но я вижу время последнего запуска в пользовательском интерфейсе Web Intelligence.

1 Ответ

2 голосов
/ 27 января 2011

С небольшой помощью Теда Уеда из службы поддержки SAP я понял это.Не все свойства заполнены по умолчанию, вам нужно добавить @* к строке запроса, чтобы получить все, то есть изменить строку:

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

на:

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