Skip to Content
Author's profile photo Jason Everly

Purging Webi document data using the Java SDK

In previous versions of BusinessObjects (6.5 and prior) application developers had the ability to purge saved data from Webi documents.

With the move to the Enterprise backend this functionality was not migrated over.

BusinessObjects Enterprise XI 3.1 has added this functionality back into the Java REBean SDK.  You can now purge saved data from a Webi template as well as reset the prompt values that were used during the last refresh of the report.

 

bq. Entire code page in JSP<br /><textarea cols=”75″ rows=”10″><%@ page import=”com.crystaldecisions.sdk.framework.*” %>
<%@ page import=”com.crystaldecisions.sdk.exception.SDKException” %>
<%@ page import=”com.crystaldecisions.sdk.occa.infostore.*” %>
<%@ page import=”com.businessobjects.rebean.wi.*” %>

<%
boolean loginSuccessful = false;
IEnterpriseSession oEnterpriseSession = null;

String username = “Administrator”;
String password = “MyPassword”;
String cmsname  = “localhost”;
String authenticationType = “secEnterprise”;

try {
     //Log in.
     oEnterpriseSession = CrystalEnterprise.getSessionMgr().logon( username, password, cmsname, authenticationType);
     if (oEnterpriseSession == null) {
          out.print(“<FONT COLOR=RED><B>Unable to login.</B></FONT>”);
     } else {
          loginSuccessful = true;
     }
} catch (SDKException sdkEx) {
     out.print(“<FONT COLOR=RED><B>ERROR ENCOUNTERED</B><BR>” + sdkEx + “</FONT>”);
}

if (loginSuccessful) {
     IInfoObject oInfoObject = null;

     String docname = “TestWebi”;

     //Grab the InfoStore from the httpsession
     IInfoStore oInfoStore = (IInfoStore) oEnterpriseSession.getService(“”, “InfoStore”);
     
     //Query for the report object in the CMS.  See the Developer Reference guide for more information the query language. 
     String query = “SELECT TOP 1 * ” +
                       “FROM CI_INFOOBJECTS ” +
                       “WHERE SI_INSTANCE = 0 And SI_Kind = ‘Webi’ ” +
                       “AND SI_NAME='” + docname + “‘”;

     IInfoObjects oInfoObjects = (IInfoObjects) oInfoStore.query(query);

     if (oInfoObjects.size() > 0) {
          //Retrieve the latest instance of the report
          oInfoObject = (IInfoObject) oInfoObjects.get(0);

          // Initialize the Report Engine
          ReportEngines oReportEngines = (ReportEngines) oEnterpriseSession.getService(“ReportEngines”);
          ReportEngine oReportEngine = (ReportEngine) oReportEngines.getService(ReportEngines.ReportEngineType.WI_REPORT_ENGINE);

          // Openning the document
          DocumentInstance oDocumentInstance = oReportEngine.openDocument(oInfoObject.getID());
          
          DataProvider oDataProvider = null;

          //Loop through dataproviders and purge data
          for (int i=0; i<oDocumentInstance.getDataProviders().getCount(); i++) {
               oDataProvider = oDocumentInstance.getDataProviders().getItem(i);

               oDataProvider.purge();

               // This option purges data as well as reset prompt values used during last refresh
               //oDataProvider.purge(true);

          }

          oDocumentInstance.save();

          oDocumentInstance.closeDocument();
     }

     oEnterpriseSession.logoff();
}
%>
</textarea>

Assigned Tags

      7 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member
      Hi Jason,

      Thanks for your post. Do you know a good tutotial to get into the BO programming world ?

      any comment is warmly appreciated.

      Kind regards, Philipp

      Author's profile photo Jason Everly
      Jason Everly
      Blog Post Author
      Thanks Philipp,

      Not any tutorials per se, though I know there are walkthroughs in the SDK guides.

      On our forums we have a couple good posts with getting started links and information that you may want to look at.

      Java Enterprise SDK:
      Read Before Posting - Where to find Business Objects Java SDK Resources

      .NET Enterprise SDK:
      Read Before Posting - Where to find Business Objects .NET SDK Resources

      I hope those help!

      Jason

      Author's profile photo Former Member
      Former Member

      Do you know if this option is also available in the .NET API? If so, where can I find documentation on it?

      Author's profile photo Islam OUAHOUDA
      Islam OUAHOUDA

      any equivalent for SAP BO > 4.0

       void purge()
      Warning: This method is no longer functional from the SAP BusinessObjects 4.0 release onwards.
       void purge(boolean purgePromptValues)
      Warning:This interface is no longer functional from the SAP BusinessObjects XI 4.0 release onwards.
      Author's profile photo Jason Everly
      Jason Everly
      Blog Post Author

      Hello Islam,

      I was not expecting to see a reply after all these years.

      My guess is you will have to use the RESTful SDK to do it, but I personally have never used it.

      Best Regards,

      Jason

      Author's profile photo Islam OUAHOUDA
      Islam OUAHOUDA

      Hello Jason,

      Thanks for the reply actually we are using the SAP BO 4.x SDK with java use only.Is there any other way to do without using any web services?

      Regards,

      Islam

      Author's profile photo Jason Everly
      Jason Everly
      Blog Post Author

      Hi Islam

      Not that I know.

      I haven't touched the SDK in a decade, but I am pretty sure the Java api in 4.x can no longer do it.

      Jason