Skip to Content
avatar image
Former Member

Modify LCM Job using SDK

Hi experts,

I'm in SAP BI 4.2 SP3 and I'm trying to do several things (using SDK), such as :

- Move a LCM Job from a folder to another one

- Schedule a LCM Job

- Maybe even modify a LCM Job or create a new one

Anyway, I found a very specific java class (com.businessobjects.lcm.job.IJob) in which I found a lot of very promising things but I have no clue about how to use it??? There is no documentation on it and I wonder if it's even possible to make that kind of things...

If you have any idea, please tell me =)

I'd be very pleased to share my work to you if everything works fine.

Best regards

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

6 Answers

  • Jun 16, 2017 at 05:30 PM

    Hi Vincent,

    Assuming you have Java SDK setup .

    Else please refer the documents:

    1.Setting up the development environment

    2.Authentication

    3.Common workflow

    -

    - Bharath

    Add comment
    10|10000 characters needed characters exceeded

  • Jun 16, 2017 at 05:38 PM

    1. Create Enterprise Session using Java SDK:

    IEnterpriseSession basicLogon() throws SDKException
    {
      ISessionMgr sessionManager = CrystalEnterprise.getSessionMgr();
      IEnterpriseSession enterpriseSession = sessionManager.logon("username", "password", "<cms>:<port>", "secEnterprise");
      return enterpriseSession;
    }

    Learn More

    2. Create LCM Job using Java SDK:

    IJob create_LCM_Job (IEnterpriseSession enterpriseSession) throws SDKException
    {
    	IInfoStore infostore = (IInfoStore) enterpriseSession.getService("InfoStore");
    	IInfoObjects newJobs = infostore.newInfoObjectCollection();
    	IJob newJob = (IJob) newJobs.add(IJob.KIND);
    	newJob.setTitle("myJob");
    	newJob.setDescription("This is a new lcm job InfoObject.");
    	newJob.setParentID(837);//set folder id
    	    	
    	infostore.commit(newJobs);	
            return newJob;
    }
    

    Learn More

    3. Modify LCM job using Java SDK

    void modify_LCM_Job(IEnterpriseSession enterpriseSession, int job_id) throws SDKException
    {
    	IInfoStore infostore = (IInfoStore) enterpriseSession.getService("InfoStore");
    	String query = "SELECT * FROM CI_INFOOBJECTS, CI_SYSTEMOBJECTS, CI_APPOBJECTS " 
    			+ "WHERE SI_KIND='" + IJob.KIND + "' "
    			+ "And SI_ID='" + job_id + "'";
    	IInfoObjects jobs = infostore.query(query);
    	    	
    	IJob job = (IJob) jobs.get(0);
    	job.setTitle("MyJob_new_name");//set new name
    	job.setParentID(1234);//changing folder id(moving from one folde to another)
            job.save();
            infostore.commit(jobs);
    }
    
    

    Learn More

    4. Schedule LCM Job using Java SDK

    Schedule InfoObject

    -

    -Bharath

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      It's ok, I finally found the solution : I missed one JAR : commentary.common.jar and everything works fine!!

      Thank you very much anyway!!

  • Jun 16, 2017 at 06:09 PM
    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 20, 2017 at 02:30 PM

    It's almost done : I was able to schedule a job but now I would like to change the destination CMS using SDK.

    I found, into the IJob type, the function setDestCMS which only accept CMS type.

    So I tried to create a CMS using import com.businessobjects.lcm.core.CMS but I don't know how to instantiate. Have you any idea of how to make it?

    Best regards,

    Add comment
    10|10000 characters needed characters exceeded

  • Jun 21, 2017 at 05:43 PM

    Please try this.

    job.properties().setProperty(IDHelper.nameToID(JobConstants.LCM_JOB_DESTINATION_CMS_NAME), "destination_cms_name");

    not tested code.

    -Bharath

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 28, 2017 at 07:50 AM

    Unfortunalty, it doesn't work...

    Here is a sample of code I just used :

    As you can see, I can see the current value of CMS_NAME (but not the other properties). And if I try to change it, it doesn't change anything into the CMC.

    I think the best way to change the destination of a LCM Job is to create a CMS object (but I really don't know how to do so...) and use the setDestCMS(CMS object) but there is actually no documentation on it...

    Damn : I'm sure I'm not so far to find a way to make it but I'm stuck with this CMS object.

    Best regards

    Add comment
    10|10000 characters needed characters exceeded