Business Intelligence – Oracle

Oracle BI EE 10.1.3.3/2 – Sending Reports to Non-OBI Users – Delivery Manager API of BI Publisher

Posted by Venkatakrishnan J on March 10, 2008

Another common question that generally comes from end users is “How do we make OBI EE Delivers to email the reports to users who are not part of a Delivery profile?”. Well, there are a variety of ways to achieve this. Let us first list those down

1.   Create a dummy user and assign as many email ids as possible to this dummy user’s delivery profile. While using Delivers, send the reports out to all these users.
2.   Create SA system subject area in BI Administrator and let the subject area be populated from database using Init Blocks. In this case, all the email ids would come from the database.
3.   Use BI Publisher Delivery Manager API to accept multiple email ids as its parameter and send the report to various users.

Today, we shall be looking at the 3rd approach which is easier to implement. Also, this provides us with much more flexibility in delivering the reports to the end users. In order to use this approach, you need to go through the basics of calling Java Classes from Delivers in my blog entry here. For the Delivery Manager API of BI Publisher to work, we need to have the following jars.

a.   Activation.jar – You can get this jar from {OracleBI}\oc4j_bi\j2ee\home\lib
b.   Mail.jar – You can get this jar from {OracleBI}\oc4j_bi\j2ee\home\lib
c.   xdocore.jar – You can get this jar from {OracleBI}\oc4j_bi\j2ee\home\applications\xmlpserver\xmlpserver\WEB-INF\lib
d.   versioninfo.jar – You can get this jar from {OracleBI}\oc4j_bi\j2ee\home\applications\xmlpserver\xmlpserver\WEB-INF\lib
e.   schedulerrpccalls.jar – You can get this jar from {OracleBI}\web\javahost\lib\scheduler

Now open JDeveloper and include the above jars in your classpath. Also, create a Java Class to enter the below code.

package bieesoap;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import oracle.apps.xdo.delivery.DeliveryException;
import oracle.apps.xdo.delivery.DeliveryManager;
import oracle.apps.xdo.delivery.DeliveryPropertyDefinitions;
import oracle.apps.xdo.delivery.DeliveryRequest;
import com.siebel.analytics.scheduler.javahostrpccalls.SchedulerJavaExtension;
import com.siebel.analytics.scheduler.javahostrpccalls.SchedulerJobException;
import com.siebel.analytics.scheduler.javahostrpccalls.SchedulerJobInfo;

import java.io.File;

import javax.activation.CommandMap;
import javax.activation.MailcapCommandMap;

import oracle.apps.xdo.delivery.local.LocalPropertyDefinitions;

public class burstEmail implements SchedulerJavaExtension{
public burstEmail() {
}

public void run(SchedulerJobInfo jobInfo) throws SchedulerJobException {
try
{
FileInputStream fis = new FileInputStream(jobInfo.getResultSetFile());
DeliveryManager dm = new DeliveryManager();
DeliveryRequest req = dm.createRequest(DeliveryManager.TYPE_LOCAL);
req.addProperty(LocalPropertyDefinitions.LOCAL_DESTINATION, “D:\\Output.pdf”);
req.setDocument(fis);
req.submit();

if (req.getStatus() == DeliveryRequest.STATUS_SUCCESSFUL)
{
MailcapCommandMap mc = (MailcapCommandMap)CommandMap.getDefaultCommandMap();
mc.addMailcap(“text/html;; x-java-content-handler=com.sun.mail.handlers.text_html”);
mc.addMailcap(“text/xml;; x-java-content-handler=com.sun.mail.handlers.text_xml”);
mc.addMailcap(“text/plain;; x-java-content-handler=com.sun.mail.handlers.text_plain”);
mc.addMailcap(“multipart/*;; x-java-content-handler=com.sun.mail.handlers.multipart_mixed”);
mc.addMailcap(“message/rfc822;; x-java-content-handler=com.sun.mail.handlers.message_rfc822”);
CommandMap.setDefaultCommandMap(mc);
req = dm.createRequest(DeliveryManager.TYPE_SMTP_EMAIL);
req.addProperty(DeliveryPropertyDefinitions.SMTP_SUBJECT, “Mail from BI Delivers”);
req.addProperty(DeliveryPropertyDefinitions.SMTP_HOST, jobInfo.parameter(1));
req.addProperty(DeliveryPropertyDefinitions.SMTP_FROM, “BIEEDelivers-Admin@oracle.com”);
req.addProperty(DeliveryPropertyDefinitions.SMTP_TO_RECIPIENTS, jobInfo.parameter(0) );
req.addProperty(DeliveryPropertyDefinitions.SMTP_CONTENT_TYPE,”application/pdf”);
req.addProperty(DeliveryPropertyDefinitions.SMTP_CONTENT_FILENAME,”Output.pdf”);
req.setDocument(“D:\\Output.pdf”);
req.submit();
req.close();
}
}
catch(Exception ex)
{
throw new SchedulerJobException(1, 1, ex.getMessage());
}

}

public void cancel() {
}

}

      

As you see, what the above code basically does is, it first stores the report in a local destination and then sends that report out to all the users. jobInfo.parameter(0) can accept comma seperated email ids as parameter. Compile the above code and bundle it into a jar file (including all the above 4 jars). Now, put this deployed jar file in {OracleBI}\web\javahost\lib. This will make the jar file to be accessible by delivers. Once this is done, create a simple ibot with PDF as the attachment

      

Now, in the advanced tab of this ibot, call the above class as shown below. This will accept 2 parameters

   1. Comma Seperated Email ids to which you want to send the report to
   2. Your SMTP mail Server

      

Now, you should be able to send emails out to multiple users. You can use it or customize the above code to your convenience. Let me know if anyone needs the jar file, i will post it here.

Advertisements

18 Responses to “Oracle BI EE 10.1.3.3/2 – Sending Reports to Non-OBI Users – Delivery Manager API of BI Publisher”

  1. Shahzad Jaffar said

    Hi,
    Please give me the “jar file”. I am very thankfull to you.

  2. Shahzad Jaffar said

    Hi,
    Please give me the “burstEmail.java” code required.

  3. Asad said

    Need jar file.
    Thanks in advance.

  4. prashant said

    Please send me burstemail.js file .We do not have license for BI publisher . I do not want to use BI publisher Delivery Manager API .Any help is apprciated. Option 1 & 2 are not useful .Thanks

  5. Austin said

    Can you send me the JAR file?

    Thanks!

  6. ssl said

    Hi,

    can i have the jar file? Don’t have java in office.
    thanks.

  7. Clement said

    Hi,

    This article is very good. Yet, we do not have Java configured on our BI server. Would there be a way to write something similar in Javascript?

    Thanks in advance.

  8. Clement said

    Hi,

    I achieved to have Java work with simple iBot (sawsched.sawsched posting information file on D:\), but am getting the following error with this one.

    +++ ThreadID: 1f9c : 2009-06-01 15:22:03.304
    java.lang.NoClassDefFoundError: oracle/apps/xdo/delivery/DeliveryManager

    Anyone can help?

    Thanks in advance,
    Clément

  9. Hari said

    Need the jar file
    Thanks

  10. Saikrishna said

    need the jar file: saikrishnavk@gmail.com

  11. Ashwin said

    Did any of u get the jar files? Please post the jar files here.

  12. Amanda said

    I have tried out the same procedure as above but its not working can anyone gudie me to do the same thing

  13. Balaji said

    Hi,

    Could you please post the jar files?

    Thanks in advance..

    Cheers,
    Bala..

  14. Amanda said

    i am getting the same exception as Clement that is

    IOException while sending message;
    nested exception is:
    javax.activation.UnsupportedDataTypeException: no object DCH for MIME type multipart/mixed;
    boundary=”—-=_Part_0_15397900.1254899470578″

    does anyone know how ot resolve this issue?

    • Gael said

      Hi,

      I have the same problem :

      IOException while sending message;
      nested exception is:
      javax.activation.UnsupportedDataTypeException: no object DCH for MIME type multipart/mixed;
      boundary=”—-=_Part_0_26009930.1266577988607″

      Does anyone can help me ?

  15. Domas said

    Anyone tryed to use this javascript in linux?

  16. Goud said

    I have followed (3) to send Reports to Non-OBI users- I am not able to send, no errors also, anyone tried and working? Please advise

  17. praneethcnv said

    Is there any method other than these three to send the obi report to a non bi user.

    Thanks in Advance.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: