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 Shawn Penner's Blog 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