cancel
Showing results for 
Search instead for 
Did you mean: 

Migrating to BI 4 - DocumentInstance.getPrompts() throws Exception

Former Member
0 Kudos

We are currently migrating to BI 4. The following lines of code:

            IWebi document = (IWebi) report;

            ReportEngines reportEngines = null;

            ReportEngine reportEngine = null;

            DocumentInstance documentInstance = null;

            try {

                      reportEngines = (ReportEngines) session.getService("ReportEngines");

                      reportEngine = reportEngines.getService(ReportEngines.ReportEngineType.WI_REPORT_ENGINE);

                      documentInstance = reportEngine.openDocument(document.getID());

                      Prompts prompts = documentInstance.getPrompts(); //this method throws exception below

...

throws following exception:

com.businessobjects.sdk.core.server.CommunicationException$UnexpectedServerException: Unable to create an instance of class 'interface com.businessobjects.sdk.core.server.IServerCommand' with qualifier 'com.sap.sl.sdk.requests.GetPromptListRequest'

          at com.businessobjects.sdk.core.exception.ExceptionBuilder.make(ExceptionBuilder.java:144)

          at com.businessobjects.sdk.core.exception.ExceptionBuilder.make(ExceptionBuilder.java:101)

          at com.businessobjects.sdk.core.server.internal.AbstractServer.processIt(AbstractServer.java:183)

          at com.businessobjects.sdk.core.server.internal.AbstractServer.process(AbstractServer.java:133)

          at com.businessobjects.sdk.core.server.internal.InstanceServer.process(InstanceServer.java:94)

          at com.sap.sl.sdk.services.util.ServerRequestProcessor.processServerRequest(ServerRequestProcessor.java:49)

          at com.sap.sl.sdk.workspace.service.WorkspaceServiceImpl.getParametersList(WorkspaceServiceImpl.java:385)

          at com.businessobjects.rebean.wi.internal.WIDocumentInstance.getParameters(WIDocumentInstance.java:1088)

          at com.businessobjects.rebean.wi.internal.WIDocumentInstance.getPrompts(WIDocumentInstance.java:316)

          at com.volvo.itbe.bit.burstingapi.prompts.ReportPrompts.setReportPrompts(ReportPrompts.java:42)

          at com.volvo.itbe.bit.burstingapi.scheduler.ReportScheduler.execute(ReportScheduler.java:109)

          at com.volvo.itbe.bit.rgds.reportGenerator.ReportGenerator.generateReport(ReportGenerator.java:118)

          at com.volvo.itbe.bit.rgds.reportGenerator.WebIReportGenerator.main(WebIReportGenerator.java:42)

Caused by: com.businessobjects.sdk.core.CoreException: Unable to create an instance of class 'interface com.businessobjects.sdk.core.server.IServerCommand' with qualifier 'com.sap.sl.sdk.requests.GetPromptListRequest'

          at com.businessobjects.sdk.core.internal.guice.GenericFactory.create(GenericFactory.java:115)

          at com.businessobjects.sdk.core.Core.create(Core.java:521)

          at com.businessobjects.sdk.core.server.internal.corba.CorbaServerImpl.doProcess(CorbaServerImpl.java:78)

          at com.businessobjects.sdk.core.server.internal.AbstractServer.processIt(AbstractServer.java:171)

          ... 10 more

Caused by: com.google.inject.ConfigurationException: Missing binding to com.businessobjects.sdk.core.server.IServerCommand annotated with @com.google.inject.name.Named(value=com.sap.sl.sdk.requests.GetPromptListRequest).

          at com.google.inject.InjectorImpl.getProvider(InjectorImpl.java:696)

          at com.google.inject.InjectorImpl.getInstance(InjectorImpl.java:724)

          at com.businessobjects.sdk.core.internal.guice.GenericFactory.create(GenericFactory.java:113)

          ... 13 more

We have included ALL BI4 java lib jars (which, btw, seems more like a quick and dirty solution) as documented in the user guide.

Please tell us what we are missing?

Cheers,

M.

PS. using BI4 SP4

=== EDIT ===

We managed to identify all required rebean libraries and this error is now resolved.

However, we are still experiencing OSGI dependency conflicts with IBM Websphere v7.5.

Br,

Marc.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Marc,

You can use the below code to create a web-i Service in 4.0

ReportEngine reportEngine = (ReportEngine)session.getService("", "WebiReportEngine");

infoStore = (IInfoStore)ession.getService("InfoStore");

This worked in our environment.

-Cimbu

Former Member
0 Kudos

Hi Cimbu,

In BI 4 some code doesn't work correctly if you will use ReportEngine to open document. For example, if you need to pass date parameters to the report.

SAP still support ReportEngine in BI 4 but do not use it more. Instead of BI uses Workspace, WorkspaceService and other services to work with reports.

-Victor

Former Member
0 Kudos

Cimbu,

In particular, the ReportEngine functionality is completely removed in BI 4.0 SP06 and on.  It can no longer be used. 

Thanks,

Mark

DellSC
Active Contributor
0 Kudos

Some, but not all, of the things you used to be able to do with ReportEngine are now available through the RESTful Web Services.  The cool thing about this SDK is that it doesn't require any BO-specific library files, so upgrading to a new version should be fairly easy (as in, no code changes or recompile required...)  I have worked with one client who has successfully replaced their old ReportEngine code with this to get the parameters for Webi Reports so that they can build an OpenDocument URL to view the report with the parameters set.

-Dell

Former Member
0 Kudos

Hello Marc,

The code that you use to open document and get prompts doesn't work in BI 4 more.

I use the following code to get document parameters.

final IDocumentInstance documentInstance = ServicesHelper.getDocumentInstanceManagementService().openDocument(

globalContext, documentID);

final Workspace workspace = ServiceProvider.getDocumentInstanceService().getWorkspace(globalContext,

documentInstance);

final WorkspaceService workspaceService =Core.getService(WorkspaceContextualService.class, globalContext);

workspaceService.getDataProviders(workspace);

workspaceService.prepare(workspace);

final ParameterService parameterService = (ParameterService) Core.getService(ParameterContextualService.class, globalContext);

final List<Parameter> parameters = parameterService.getNeededParameters(workspace);

for (final Parameter promptParameter : promptParameters)

{

...

}

Thanks,

Victor

Former Member
0 Kudos

Hi Victor,

Thanks for your post- it has helped me out a great deal. 

One thing I haven't been able to figure out (The lack of documentation on these methods is frustrating) is how to retrieve the saved values from these parameters. 

I started going down the path of

Parameter.getAnswerInformation().getPreviousAnswer()....

But haven't been able to find a method that actually gives the saved values. 

Do you have any hints on how to get what I'm looking for?

Thanks!

Mark

Former Member
0 Kudos

In case this helps anyone else, I found a solution:

promptParameter.getAnswerInformation().getPreviousAnswer().eContents().get(x).eContents().toString();

iterate through a size() function with x to get multi values.

Thanks!

Former Member
0 Kudos

Hi Mark,

Sorry for delay.

I can suggest you the following code example.

    private static final Locale DEFAULT_LOCALE = Locale.getDefault();

    private final LocaleFormattings localeFormattings = new LocaleFormattings(DEFAULT_LOCALE);

    public List<String> getParameterValues(final IContext globalContext, final int id, final String parameterName)

            throws SDKException

    {

        if (StringUtils.isBlank(parameterName))

        {

            return null;

        }

        final IDocumentInstance documentInstance = ServicesHelper.getDocumentInstanceManagementService().openDocument(

                globalContext, id);

        final Workspace workspace = ServiceProvider.getDocumentInstanceService().getWorkspace(globalContext,

                documentInstance);

        boServiceHelper.getWorkspaceService(globalContext).prepare(workspace);

        final List<Parameter> parameters = ((ParameterService) Core.getService(ParameterContextualService.class, globalContext)).getNeededParameters(

                workspace);

        for (final Parameter parameter : parameters)

        {

            if (parameterName.equals(parameter.getIdentifier()))

            {

                final AnswerInformation answerInformation = parameter.getAnswerInformation();

                final DataType dataType = answerInformation.getDataType();

                final SelectionType selectionType = answerInformation.getSelectionType();

                final List<String> result = new ArrayList<String>();

                if (selectionType.equals(SelectionType.SINGLE_VALUE))

                {

                    final SingleValueAnswer answer = (SingleValueAnswer) answerInformation.getPreviousAnswer();

                    final String value = formatField(answer.getAnswerValue().getCaptionField(),

                            dataType);

                    result.add(value);

                }

                else if (selectionType.equals(SelectionType.MULTI_VALUE))

                {

                    final MultiValueAnswer answer = (MultiValueAnswer) answerInformation.getPreviousAnswer();

                    for (final AnswerValue answerValue : answer.getAnswerValues())

                    {

                        final String value = formatField(answerValue.getCaptionField(), dataType);

                        result.add(value);

                    }

                }

                return result;

            }

        }

        return null;

    }

    public String formatField(final Field field, final DataType dataType)

    {

        String result = "";

        if (field != null)

        {

            final FieldType fieldType = field.getType();

            if (FieldType.DATE.equals(fieldType))

            {

                final Date date = field.getDate();

                if (date != null)

                {

                    result = dataType == DataType.DATE_TIME ? getDateTimeFormat(DEFAULT_LOCALE).format(date)

                            : getDateFormat(DEFAULT_LOCALE).format(date);

                }

            }

            else if (FieldType.DOUBLE.equals(fieldType))

            {

                final Double d = field.getDouble();

                if (d != null)

                {

                    result = localeFormattings.formatDouble(d);

                }

            }

            else if (FieldType.STRING.equals(fieldType))

            {

                result = field.getString();

            }

        }

        return result;

    }

-Victor

Former Member
0 Kudos

Hi Marc,

I am also facing the same issue, can you please name required rebean libraries?

Thanks,

Ashok