How to disable version check in Upgrade Management Tool

To avoid error

"Version check failed. The source system or source BIAR file must be of an older version. The destination system system must be of the current version. (UMT 20012)"

you can use (at own risk) the option

-internal_use_only_noversioncheck

internal_use_only_noversioncheck

Web Intelligence RESTful Web Services SDK with Java

In this post you will find an example of how to use Web Intelligence RESTful Web Services SDK with Java. The code displays names of the variables for each web intelligence document.

To run the code, you will need json library that can be found for instance on http://mvnrepository.com/artifact/org.json/json/20160212

Example (Program.java)

import org.json.JSONArray;
import org.json.JSONObject;

public class Program {
  public static void main(String[] args) throws Exception {
    // Establish connection
    Bo4Connection connection = new Bo4Connection("http://ANALYTIX:6405/biprws");
    connection.connect("Administrator", "1-Password", "secEnterprise");
    try {
      // Get list of documents
      String docs = connection.query("GET", "/documents", "application/json");
      JSONArray documents = new JSONObject(docs).getJSONObject("documents").getJSONArray("document");
      for (int i = 0; i < documents.length(); i++) {
        JSONObject document = documents.getJSONObject(i);
        int id = document.getInt("id");
	// Get information about the document
        String doc = connection.query("GET", "/documents/" + id, "application/json");
        JSONObject info = new JSONObject(doc).getJSONObject("document");
        String name = info.getString("name");
        String path = info.getString("path");
        System.out.println(path + "/" + name);
	// Get variables of the document
        String var = connection.query("GET", "/documents/" + id + "/variables", "application/json");
        JSONArray variables = new JSONObject(var).getJSONObject("variables").getJSONArray("variable");
        for (int j = 0; j < variables.length(); j++) {
	  // Print variable information
          JSONObject variable = variables.getJSONObject(j);
          String variableName = variable.getString("name");
          System.out.println(variableName);
        }
      }
    } finally {
      connection.disconnect();
    }
  }
}

API (Bo4Connection.java)

The helper API is very simple and contains a constructor and 3 functions: connect(username, password, auth), disconnect(), and query(method, link, format).

The constructor's parameter is the link to web services.

Bo4Connection connection = new Bo4Connection("http://ANALYTIX:6405/biprws");

The call to web services is performed with function query. For instance, to get list of documents we send a GET request to /documents, and we want to get result in json format.

connection.query("GET", "/documents", "application/json");

To get the list of all possible request, please refer to RESTful Web Services SDK Developer Guides on http://scn.sap.com/docs/DOC-27465

import java.io.*;
import java.net.*;
import org.json.JSONObject;

public class Bo4Connection {
  
  private String biprws;
  private String token;
  
  public Bo4Connection(String biprws) {
    this.biprws = biprws;
  }
  
  public String query(String method, String link, String format) throws Exception {
    return query(method, biprws + "/raylight/v1" + link, format, token, null);
  }
  
  public void connect(String username, String password, String auth) throws Exception {
    String link = biprws + "/logon/long/";    
    String method = "POST";
    String format = "application/json";
    String body = "<attrs xmlns=\"http://www.sap.com/rws/bip\">"
      + "<attr name=\"userName\" type=\"string\">" + username + "</attr>"
      + "<attr name=\"password\" type=\"string\">" + password + "</attr>"
      + "<attr name=\"auth\" type=\"string\">" + auth + "</attr>"
      + "</attrs>";
    JSONObject json = new JSONObject(query(method, link, format, null, body));
    token = json.getString("logonToken");
  }
  
  public void disconnect() throws Exception {
    String link = biprws + "/logoff/";    
    String method = "POST";
    String format = "application/json";
    query(method, link, format, null, null);
  }

  public static String query(String method, String link, String format, 
      String token, String content) throws Exception {
    HttpURLConnection conn = null;
    try {
      URL url = new URL(link);    
      conn = (HttpURLConnection) url.openConnection();
      conn.setRequestMethod(method);
      conn.setRequestProperty("Accept", format);
      if (token != null) {
        String logonToken = "\"" + token + "\"";
        conn.setRequestProperty("X-SAP-LogonToken", logonToken);
      }
      conn.setDoOutput(true);
      conn.setDoInput(true);
      if (content != null) {
        conn.setRequestProperty("Content-Type", 
            "application/xml; charset=utf-8");
        conn.setRequestProperty("Content-Length", 
            Integer.toString(content.length()));
        OutputStreamWriter out = new OutputStreamWriter(conn.getOutputStream());
        out.write(content, 0, content.length());
        out.flush();
      }
      conn.connect();
      if (conn.getResponseCode() != 200) {
        throw new Exception("HTTP Error Code: " + conn.getResponseCode() 
          + " " + conn.getResponseMessage());
      }
      BufferedReader br = new BufferedReader(
        new InputStreamReader(conn.getInputStream()));
      StringBuilder result = new StringBuilder(); 
      String output;
      while ((output = br.readLine()) != null) {
        result.append(output);
        result.append('\n');
      }
      br.close();
      return result.toString();
    } finally {
      if (conn != null) {
        conn.disconnect();
      }
    }
  }
}

Re-deploying BusinessObjects XI 3.1 web applications

These steps describe the procedure for re-deploying web applications for BO XI 3.1 with Tomcat 7. Re-deploying is required, for instance, if you uninstall a language pack from Business Objects.

  • Stop Tomcat
  • Backup Tomcat7 folder located in Business Objects folder
  • Remove all applications except ROOT, manager, host-manager, docs, examples (these are Tomcat applications) from Tomcat7\webapps
  • Remove all subfolders from Tomcat7\work\Catalina\localhost
  • Start cmd.exe as Administrator
  • Change directory to deployment located in Business Objects folder
  • Run wdeploy tomcat7 deployall
  • If the message is "BUILD SUCCESSFUL", the application are successfully deployed.
  • Start Tomcat and check web applications.

How to edit merged dimensions in BO BI 4.x

In BO XI 3.1, to edit a merged dimension, we could right click on a merged dimension, and select "Edit merged dimension" from pop up menu, this would open a dialog for editing merged dimensions. This has changed in BI 4.x, and it might be not obvious how to adjust merged dimensions.

Add dimensions to a merged dimension:

Select the merged dimension and objects you want to add, click right button, select “Add to Merge”.

merge1

Remove dimensions from a merged dimension:

Select dimensions that you want to remove from merged dimensions, click right button, and select "Remove from Merge"

merge2

Referencing to a document's block in OpenDocument link

When we use a OpenDocument link to open a Webi document, the report is displayed with a number of controls.

http://localhost:8080/OpenDocument/opendoc/openDocument.jsp?sType=wid&sIDType=CUID&iDocID=Aan15wubifNFikJjmlT.LVU

pic1

 

Sometimes we want to get rid of the controls and display only specific block (for instance, when it needs to be embedded into another application). This can be done with undocumented parameter sReportPart

The link will look like:

http://localhost:8080/OpenDocument/opendoc/openDocument.jsp?sType=wid&sIDType=CUID&iDocID=Aan15wubifNFikJjmlT.LVU&sReportPart=UIREF:RID=469:BID=473&mode=part

pic3

The tricky part is to find the ids: RID – Report id, and BID – Block id.

To find the IDs,

  • open the document in Web Intelligence Rich Client and save it as WID file
  • rename WID file to ZIP
  • unpack ZIP file
  • open file Data\RE\DOCSPEC
  • find necessary report element with RID attribute
  • find necessary block element with BID attribute

pic2

Short TNS for Oracle connection

To change server name for an Oracle connection in BusinessObjects, we need to update the definition of SID in tnsnames.ora file. You can specify the server name, port and instance in the connection:

Short TNS in Designer

Webi – Validate value in Webi report

We want to validate values of the dimension [Job No.] from Query 1 against values of [Job No.] from query Valid within Webi report.
Untitled

Untitled2

We can create a detail object [Valid Job Name] for merged object [Job No.] that points to unmerged dimension from the query Valid [Valid].[Job Name] and use it in the following expression to check if the value is valid:

=Not(IsNull([Valid Job Name]))

So the point is to use unmerged object expression like =Not(IsNull([Valid].[Job No.])) will not work.

Untitled4

Untitled5

Image with Hyperlink in Webi report

We want to add hyperlink to an image in Webi document.

Here I am using an image with name UserLogo1.png that has size 165 x 25.

Copy your image to the server to the folder:

C:\BusinessObjects\BusinessObjects Enterprise 12.0\images

Create a cell and set properties to the following.

Text: <a href='http://google.com' style='width:165px; height:25px;' target='_blank'>&nbsp;</a>

Width: 165

Height: 25

Read cell content as: Hyperlink

Background image: boimg://UserLogo1.png

image hyperlink in webi

(It does not work in PDF and Excel)

Format date in Batch yyyyMMdd

The usual approach to build a timestamp for a log files in a batch is to use standard Windows utilities date and time. However the format of the output depends on locale and it is almost not possible to make the script which runs on any machine. A solution might be to create a small java tool.

Source file (datetime.java):

import java.text.SimpleDateFormat;
import java.util.Calendar;
public class datetime {
  public static void main(String[] args) {
    System.out.println(new SimpleDateFormat("yyyyMMdd_HHmmss")
          .format(Calendar.getInstance().getTime()));
  }
}

Compilation (you need JDK for this):

javac datatime.java

The code will be compiled into datatime.class.

Use in a batch file:

java datetime>logdate.txt
set /p STAMP=<logdate.txt
set LOG=C:\logs\%STAMP%.log
call Main.bat > %LOG%

Find MenuID and RoleID corresponding to ComponentID in Maconomy Portal

SELECT COMPONENTID, MENUID, ROLEID FROM MENUITEM WHERE COMPONENTID LIKE '%::BPM::%'