on 08-14-2015 11:18 AM
Hi All,
I have been using SAP BO Java SDK for a while now to connect to BO Repository and access different kinds of data. It has been extremely useful in a ton of situations. Links like neatly explains on how to write these codes and execute them as a part of AdminTools.
So far, I have used SDK as JSP that is kept in AdminTools and is executed via Internet Explorer. I have also written & ran Java code from Eclipse to access information. Now I'm trying to export the code as a JAR file and I want to upload it to BO as Program Object so that I can run it them from InfoView/LaunchPad and not Eclipse or AdminTools.
How do I modify my code - say the below one - for that purpose? Could you please guide me through the steps? This code prints all the parameters used in the scheduled instances of a WebI report. It's only a sample without any try-catch blocks or exception handling.
Needless to say that I'm not at all a Java expert. Also, it would be great if someone can answer this as an SCN Document so that everyone can use the same concepts.
import all the required stuff;
public class paramsInScheduledInstances{
public static void main(String[] args) throws SDKException{
Scanner scanner1 = new Scanner( System.in );
System.out.print("Enter user name : ");
String userName = scanner1.nextLine();
System.out.print("Enter password : ");
String password = scanner1.nextLine();
System.out.print("Enter System Name : ");
String envmnt = scanner1.nextLine();
System.out.print("Enter parent CUID : ");
String parentCUID = scanner1.nextLine();
IEnterpriseSession eSession = null;
System.out.println("Connecting...");
ISessionMgr sessionMgr = CrystalEnterprise.getSessionMgr();
eSession = sessionMgr.logon(userName, password, envmnt,"secEnterprise");
System.out.println("Connected!");
IInfoStore iStore = (IInfoStore) eSession.getService("InfoStore");
IInfoObjects objs = iStore.query("Select * from ci_infoobjects where SI_PARENT_CUID = '"+ parentCUID +"'");
for (int i=0; i<objs.size(); i++){
IInfoObject report = (IInfoObject)objs.get(i);
IProperties prompts = (IProperties) report.getProcessingInfo().properties().getProperty("SI_WEBI_PROMPTS").getValue();
int num_prompts = ((Integer) prompts.getProperty("SI_TOTAL").getValue()).intValue();
for (int nPromptNameIndex = 1; nPromptNameIndex <= num_prompts; nPromptNameIndex++) {
Integer propNum = new Integer(nPromptNameIndex);
IProperties prompt = (IProperties) prompts.getProperty(propNum).getValue();
IProperties promptValue = (IProperties) prompt.getProperty("SI_VALUES").getValue();
String strTotalValue = promptValue.getProperty("SI_TOTAL").getValue().toString();
Integer IntTotalValue = new Integer(strTotalValue);
int numPromptValues = IntTotalValue.intValue();
String promptDataValues="";
for (int nPromptValueIndex = 1; nPromptValueIndex <= numPromptValues; nPromptValueIndex++) {
Integer propvalueNum = new Integer(nPromptValueIndex);
String strpropvalueNum = propvalueNum.toString();
String singlePromptVal = promptValue.getProperty(strpropvalueNum).getValue().toString();
if(nPromptValueIndex == 1)
promptDataValues = singlePromptVal;
else
promptDataValues = promptDataValues + ";" + singlePromptVal;
}
System.out.println(promptDataValues);
}
}
if(eSession != null)
eSession.logoff();
}
}
Thanks a lot,
Antony P
You class needs to implement the com.crystaldecisions.sdk.plugin.desktop.program.IProgramBase interface in order to run correctly as a program in BO. When using this interface, BO will automatically pass in the BO credentials to the program in this format:
UserID Password CMSName AuthenticationType
AuthenticationType can be secEnterprise, secLDAP, etc.
-Dell
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
As the program object would be published to BusinessObjects, it would take the credentails of the logged in user.
Any BO java program to be able to be used as a Program Object we need to make sure two things.
1. Implement the interface IProgramBase
2. Your code logic should be written in run() method of IProgramBase interface.
There are a lot of samples available of scn under documents and blogs which have been using java program objects.
Below are some links you can refer
There are many blogs in the blog section of this forum space.
You can find more details regarding programobjects from BusinessObjects java sdk developers guide available at help.sap.com
Thanks,
Prithvi
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.