cancel
Showing results for 
Search instead for 
Did you mean: 

How to make a Java Program Object that can run on InfoView or LaunchPad?

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (1)

Answers (1)

DellSC
Active Contributor
0 Kudos

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

Former Member
0 Kudos

Hi,

Thanks!

So UserID, Password, CMSName & AuthenticationType are variables that will already have values in them?


If you could provide a sample code for reference, that would be great.


Also, the System.out.println() would work as well?


Thanks,

Antony

Former Member
0 Kudos

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

DellSC
Active Contributor
0 Kudos

I wouldn't use System.out.println().  Instead, I use Log4J to implement logging to a file.  If you have a program that runs inside BO, you're probably not going to see a screen that contains messages when the program runs.

-Dell

Former Member
0 Kudos

Adding to Dell's comment, System.out.println() would capture the details when program object is run in a text file. You can see the statements when you click on the program object instance once scheduled. It will download a text file with all the System.out statements.

Thanks,

Prithvi