
In this blog, I will be demonstrating a program object to export the details of usergroups in a Business Objects environment.
Prerequisites:
Creation of a Java Program Object:
import com.crystaldecisions.sdk.plugin.desktop.program.*;
import com.crystaldecisions.sdk.framework.*;
import com.crystaldecisions.sdk.framework.*;
import com.crystaldecisions.sdk.exception.*;
import com.crystaldecisions.sdk.occa.infostore.*;
import com.crystaldecisions.sdk.plugin.desktop.server.IServer;
import com.crystaldecisions.sdk.occa.infostore.CePropertyID;
import com.crystaldecisions.sdk.plugin.desktop.user.*;
import com.crystaldecisions.sdk.properties.*;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFRow;
import java.io.*;
import java.util.*;
public class Usergroup implements IProgramBase
{
public void run(IEnterpriseSession enterprisesession,IInfoStore infostore,String str[]) throws SDKException
{
System.out.println("Connected to " + enterprisesession.getCMSName() + "CMS");
System.out.println("Using the credentials of " + enterprisesession.getUserInfo().getUserName() );
int index=1;
int j =1;
XSSFWorkbook wb = new XSSFWorkbook();
XSSFSheet sheet = wb.createSheet("new sheet");
XSSFRow rowhead = sheet.createRow((short)0);
rowhead.createCell((short) 0).setCellValue("Sr No.");
rowhead.createCell((short) 1).setCellValue("User Group");
rowhead.createCell((short) 2).setCellValue("Description");
try
{
infostore = (IInfoStore) enterprisesession.getService("", "InfoStore");
IInfoObjects infoobjects = infostore.query("Select * From CI_SYSTEMOBJECTS Where SI_Kind='Usergroup'");
for(int i=0;i<infoobjects.size();i++)
{
IInfoObject user = (IInfoObject) infoobjects.get(i);
XSSFRow row = sheet.createRow((short)index);
row.createCell((short) 0).setCellValue(j);
row.createCell((short) 1).setCellValue(user.getTitle());
row.createCell((short) 2).setCellValue(user.getDescription());
j++;
index++;
}
Date date=new Date();
String date1= date.toString();
String date2=date1.replaceAll("\\W", "_");
FileOutputStream fileOut = new FileOutputStream(str[0]+"_"+date2 +".xlsx");
wb.write(fileOut);
fileOut.close();
System.out.println(" Excel file created successfully");
}
catch(Exception e)
{
System.out.println(e.getMessage());
}
}
}
http://help.sap.com/businessobject/product_guides/boexir4/en/xi4_boejava_dg_en.zip
http://help.sap.com/businessobject/product_guides/boexir31/en/boesdk_java_dg_12_en.zip
Publishing the Java Program Object to the Enterprise System:
You would then have an excel file generated at the above specified location with the details of usergroups in a Business Objects environment.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
12 | |
7 | |
6 | |
6 | |
6 | |
5 | |
4 | |
4 | |
4 | |
4 |