26
An Oracle White Paper September, 2011 Using Oracle BI Publisher for Siebel Proposals

White Paper - Using BI Publisher for Siebel Proposals

Embed Size (px)

Citation preview

Page 1: White Paper - Using BI Publisher for Siebel Proposals

An Oracle White Paper

September, 2011

Using Oracle BI Publisher for Siebel Proposals

Page 2: White Paper - Using BI Publisher for Siebel Proposals

Oracle White Paper— Using BI Publisher for Siebel Proposals

Executive Overview ........................................................................... 1

Introduction ....................................................................................... 2

Functionality ...................................................................................... 3

Installation ......................................................................................... 6

Runtime Flow .................................................................................... 7

Configuration Changes ...................................................................... 8

Applets .......................................................................................... 8

Business Components ................................................................. 12

Business Components Fields ...................................................... 12

Table ........................................................................................... 13

Business Objects ......................................................................... 13

Link.............................................................................................. 14

Picklist ......................................................................................... 14

View ............................................................................................ 14

Workflow Process ........................................................................ 14

Business Service ......................................................................... 15

Testing ............................................................................................ 23

Workflow Process ........................................................................ 23

Page 3: White Paper - Using BI Publisher for Siebel Proposals

Oracle White Paper— Using BI Publisher for Siebel Proposals

1

Executive Overview

This document details how to use the Siebel Reporting integration with Oracle BI

Publisher for generating Siebel Proposal type documents. The Siebel CRM and Oracle BI

Publisher integration exists for authoring and generating reports, however with the Report

Business Service it can also be used to generate other types of document like Proposals

or Quotes and attach the output to the chosen entity.

This white paper is not intended to replace or reuse any of the standard Siebel Proposals

functionality using the Document Server, it is intended to illustrate how to use a

customised solution with the Report Business Service for generating standard documents

and attaching the output to an entity as a standard Siebel attachment.

The solution should work with any Siebel BI Publisher integration where the Report

Business Service is available. For this white paper, the solution was tested with Siebel

Web Client 8.1.1.5 and Oracle BI Publisher 10.1.3.4.1.

Please note that this technical white paper details example configurations and the steps

required may be different for various environments and architectures.

Page 4: White Paper - Using BI Publisher for Siebel Proposals

Oracle White Paper— Using BI Publisher for Siebel Proposals

2

Introduction

The solution offered in this white paper could provide the following benefits:-

For customers already using Siebel BI Publisher integration for reporting, with similar

requirements to generate standard Proposal or Quote documents and attach them to

the parent entity, this solution can be used and would remove the requirement for a

another document generation engine (Document Server), reducing total cost of

ownership (TCO) in the enterprise.

For multilingual requirements, using this solution only requires a single Proposal

template since translation of the template is done via .xlf files registered on the BI

Publisher server. This standardized process reduces the maintenance overhead of

multilingual templates.

Using BI Publisher for document generation offers many output formats, in particular

the option to output in PDF (read only) format. This is in addition to .RTF format,

which is the only format available with the Document Server solution.

Using BI Publisher for document generation is much more scalable in comparison to

the existing Document Server solution. The BI Publisher server can be scaled, load

balanced, clustered for failover, and also handles high concurrency. It is also

deployed as a java application that can run on many platforms. Document Server can

only run on Microsoft Windows, can‟t be clustered or load balanced, and runs in a

sequential mode.

Page 5: White Paper - Using BI Publisher for Siebel Proposals

Oracle White Paper— Using BI Publisher for Siebel Proposals

3

Functionality

The solution offered in this white paper provides the following functionality:-

A new view and applet for an Opportunity, similar to the „Proposals‟ view where a user can

generate documents against an Opportunity by clicking on the „Generate Proposal‟ button.

The same concept can be applied to any Siebel entity.

An „Auto Proposal‟ button which quickly creates a new record for the document generation

with pre defined defaults.

Figure 1. Screenshot showing detail view / applet where user can click ‘Generate Proposal’ and ‘Auto Proposal’.

The user has the ability to choose the output type from a pre defined List of Values. For

example, RTF or PDF output format. All file types that can are supported by the Siebel

Reporting integration with Oracle BI Publisher are possible.

The user has the ability to choose a document output language, the generation of

multilingual documents works in exactly the same manner as for Siebel Reports.

The user can choose the report template to use for the document generation. Note that all

templates must exist and be registered as a report template. If users wish to create their own

templates and share them with other users, this is the same as standard Siebel reporting

functonality.

Page 6: White Paper - Using BI Publisher for Siebel Proposals

Oracle White Paper— Using BI Publisher for Siebel Proposals

4

Figure 2. Screenshot showing the selection of a Proposal template.

In this concept the user can enter a query (also useful for testing purposes) for the document

generation. In your solution you may want to add logic to pre define the query (QuerySpec

input property) passed for document generation and remove this field. The value of the

Query Spec used must be in the correct notation, similar to below:

Figure 3. Screenshot showing the Query Spec field on the applet.

Once the „Generate Proposal‟ button is clicked, the report is generated via the Report

Business Service and the Oracle BI Pbulisher server. The output is retrieved and stored in

the Siebel File System as an attachment to the parent entity. The report is also registered in

the „My BI Publisher Reports‟ view.

Page 7: White Paper - Using BI Publisher for Siebel Proposals

Oracle White Paper— Using BI Publisher for Siebel Proposals

5

Figure 4. Screenshot showing the generated document in the Attachments applet.

Temporary documents stored are also cleaned up.

Logging statements exist for easy debugging.

An example Workflow Process is included to test the report generation via the Business

Service Simulator.

The Business Service is intended to be generic, meaning for each applet and entity where you

wish to generate documents, you only need to change the Applet Server Script input

properties for report generation and attaching the file.

The solution offered in this white paper does not provide the following:-

The Proposal library and template views and temapltes are not used in any way. All

templates must exist as Siebel Reports templates and be registered in the Reports views.

The Document Server is not used at all in this solution. This solution does not allow for BI

Publisher reports to be included in Proposals generated via the Document Server.

The solution was tested on the Siebel Web Client. It has not been tested on the Mobile /

Dedicated Web Client.

Page 8: White Paper - Using BI Publisher for Siebel Proposals

Oracle White Paper— Using BI Publisher for Siebel Proposals

6

Installation

An overview of the installation steps to enable this solution is detailed below; it is assumed that a

working Siebel BI Publisher integration for Siebel reporting is already present and that the

Report Business Service exists in the repository.

For more information on the Report Business Service please see Oracle Support document

“Siebel BI Publisher 8 Reports Business Service (Doc ID 823360.1)”.

The installation steps are as follows:-

Siebel Tools

Please note, the steps below using the archive files provided offer a fast way to import the new

objects and changes into the repository.

1) Extract the .zip file. Lock projects (XMLP Integration, Table Opty, Oppty (SSE)) in Tools

2) Import BI Publisher Proposals.sif

3) Observe the proposed changes and choose to „Overwrite‟ changes or just keep the default

„Merge‟ option.

4) Apply the table changes (click Apply/DDL > choose Apply)

5) Deploy the Workflow Process if required.

6) Stop Siebel Server, Compile SRF, Restart Siebel Server

Siebel Application

7) Add new view, create new responsibility (optional) and associate the new view (Opportunity

BI Publisher Proposals View) to the relevant responsibility.

8) Add new List of Values for XMLP_PROPOSAL_OUTPUT_TYPE depending on which

output types you want. This LOV can also be multilingual.

9) Clear cache, Re-login to Siebel application

Page 9: White Paper - Using BI Publisher for Siebel Proposals

Oracle White Paper— Using BI Publisher for Siebel Proposals

7

Runtime Flow

A detailed overview of the runtime flow for this solution:-

User makes applet selection for Proposal

Generate Proposal button invokes method GenerateBIPReport()

Applet Server Script method GenerateBIPReport() captures input values

Input values passed to „BIP Proposals‟ Business Service, method ExecuteBIPReport()

„BIP Proposals‟ Business Service method ExecuteBIPReport()

prepares input parameters

„GenerateBIPReport‟ method invoked in

XMLP Driver Service

Report generated via BI Publisher Server, output in „My BI Publisher Reports‟

„BIP Proposals‟ Business Service method AttachBIPReport() called

Report extracted from Siebel File System and written to Attachment BC

„BIP Proposals‟ Business Service method CleanUpDoc() called to remove temp file

User can refresh the applet to see hyperlink for generated document. Document opened

from Attachments applet

Input values for Report Generation

Input values for where to Attach output

Uses Input values for Report Generation

Locates report template

Uses Input values for Attach output

Page 10: White Paper - Using BI Publisher for Siebel Proposals

Oracle White Paper— Using BI Publisher for Siebel Proposals

8

Configuration Changes

The following configuration object changes and primary properties are contained in the archive

files associated with this white paper:

Applets

APPLET

NAME BUSCOMP COMMENTS

BI Publisher Proposals Report

Pick Applet

Report Template BC Search Specification to restrict certain report templates set to:

[Report Name] ~LIKE "Proposal*"

Opportunity BI Publisher

Proposals List Applet

Opportunity BI Publisher

Proposals

Drilldown Object set to: Opportunity Attachment View

The applet contains 2 buttons which are controls that invoke

methods “GenerateBIPReport” and “AutoBIPProposal”

Applet User Properties added to enable both buttons.

APPLET SERVER SCRIPT

Opportunity BI Publisher Proposals List Applet

function WebApplet_PreInvokeMethod (MethodName)

{

if (MethodName == "GenerateBIPReport")

try {

//Method to retrieve applet defaults and instantiate the BIP Proposals Business Service

LogFile("GenerateReport. 10. Started");

var psInput1 = TheApplication().NewPropertySet();

var psOutput1 = TheApplication().NewPropertySet();

//Parent entity context

var ParentEntityId = this.BusComp().GetFieldValue("Opportunity Id");//Parent entity

//Run Report query inputs

var vPositionId = TheApplication().PositionId();//also PositionName()

var LoginId = TheApplication().LoginId();

Page 11: White Paper - Using BI Publisher for Siebel Proposals

Oracle White Paper— Using BI Publisher for Siebel Proposals

9

var QuerySpec = this.BusComp().GetFieldValue("Query Spec");//Bookmark query to pass to IO

var ViewMode = "0";//Viewmode for report generation can also used named constants ie SalesRepView

var OutputType = this.BusComp().GetFieldValue("Output Type");

var ReportLanguage = this.BusComp().GetFieldValue("Language Name");

var TemplateName = this.BusComp().GetFieldValue("Template");//Report Name

var TemplateId = this.BusComp().GetFieldValue("Template Id");//Report Template Id

psInput1.SetProperty("Position Id", vPositionId);//User position id

psInput1.SetProperty("Login Id", LoginId);//User login id

psInput1.SetProperty("Query Spec", QuerySpec);//Query Spec

psInput1.SetProperty("View Mode", ViewMode);//View Mode

psInput1.SetProperty("Output Type", OutputType);//Output type i.e. pdf

psInput1.SetProperty("Report Language", ReportLanguage);//ReportLanguage

psInput1.SetProperty("Template Name", TemplateName);//report name

psInput1.SetProperty("Template Id", TemplateId);//report template id

LogFile("GenerateReport. 25. Inputs: QuerySpec: " + QuerySpec + " TemplateName: " + TemplateName + "

TemplateId: " + TemplateId);

LogFile("GenerateReport. 30. Calling Business Service");

var oService1 = TheApplication().GetService("BIP Proposals");

oService1.InvokeMethod("ExecuteBIPReport", psInput1, psOutput1);

LogFile("GenerateReport. 40. Finished Business Service");

var sReportName = psOutput1.GetProperty("Report Output Name");

var sReportId = psOutput1.GetProperty("Report Output Id");

LogFile("GenerateReport. 41. Report Output Name: " + sReportName + " Report Output Id: " + sReportId);

LogFile("GenerateReport. 43. Calling AttachReport.");

var psInput2 = TheApplication().NewPropertySet();

var psOutput2 = TheApplication().NewPropertySet();

//Where to Attach inputs

//var ProposalName = this.BusComp().GetFieldValue("Proposal Name");//to rename attached file if required

psInput2.SetProperty("Report Id", sReportId);//report output id

Page 12: White Paper - Using BI Publisher for Siebel Proposals

Oracle White Paper— Using BI Publisher for Siebel Proposals

10

psInput2.SetProperty("Output Name", sReportName);//Report name generated

psInput2.SetProperty("Entity Id", ParentEntityId);//Entity Parent Id

psInput2.SetProperty("Entity Parent Field", "Oppty Id");//Entity Parent Fieldname

psInput2.SetProperty("Entity Primary", "Opportunity");//Entity Primary

psInput2.SetProperty("Entity Name", "Opportunity Attachment");//Name of the destination Attachment BC

psInput2.SetProperty("Entity Object", "Opportunity");//Name of the destination Attachment B0

//psInput2.SetProperty("Entity Filename Field", "OpptyFileName"); //Filename field in Attach BC

//psInput2.SetProperty("Propsosal Name", ProposalName);//Custom Proposal filename

LogFile("GenerateReport. 45. AttachReport. Inputs: Output Name: " + sReportName + " Entity Id: "+ ParentEntityId + "

Report Id: "+ sReportId);

var oService2 = TheApplication().GetService("BIP Proposals");

oService2.InvokeMethod("AttachBIPReport", psInput2, psOutput2);

var AttId = psOutput2.GetProperty("AttRowId")

LogFile("GenerateReport. 47. AttId outputs: " + AttId);

this.BusComp().SetFieldValue("Attachment Id", AttId);//need the attachment row_id for a join.

this.BusComp().WriteRecord();

//this.BusComp().InvokeMethod("RefreshRecord");

}//end try

finally {

psInput1 = null;

psOutput1 = null;

psInput2 = null;

psOutput2 = null;

oService1 = null;

oService2 = null;

LogFile("GenerateBIPReport. 50. Finished”);

}//end finally

return (CancelOperation);

}

Page 13: White Paper - Using BI Publisher for Siebel Proposals

Oracle White Paper— Using BI Publisher for Siebel Proposals

11

if (MethodName == "AutoBIPProposal")

{

//Method to specify default fields values that are set when user clicks this button.

try {

LogFile("AutoBIPProposal. 10. Started");

var ProposalBO = this.BusObject();

var ProposalBC = this.BusComp();

var currentDate = new Date;

var genDate;

Clib.strftime(genDate, "%m/%d/%Y %H:%M:%S", currentDate);

ProposalBC.NewRecord(NewAfter);

//ProposalBC.SetFieldValue("Name", genDate);

ProposalBC.SetFieldValue("Output Type", "PDF");

ProposalBC.SetFieldValue("Language Name", "ENU");

ProposalBC.SetFieldValue("Template", "Proposal Opportunity");

ProposalBC.SetFieldValue("Template Id", "88-3H53D");//retrieval of this field value could be scripted

ProposalBC.WriteRecord();

}//end try

finally {

ProposalBC = null;

ProposalBO = null;

LogFile("AutoBIPProposal. 30. BIP Proposals Service Finished");

}//end finally

//this.InvokeMethod("RefreshRecord");

return (CancelOperation);

}

return (ContinueOperation);

}

function LogFile(sFile)

{

Page 14: White Paper - Using BI Publisher for Siebel Proposals

Oracle White Paper— Using BI Publisher for Siebel Proposals

12

//Note the directory path below needs to be modified accordingly to an existing path to avoid error

var MyFile = Clib.fopen("D:\\21219\\tempdir\\BIPProposals_Applet_Log.txt", "at");

var sTime = Clib.ctime(Clib.time());

Clib.fputs(sTime + ": " + sFile + "\n", MyFile);

Clib.fclose(MyFile);

}

Business Components

BUSINESS COMPONENT

NAME TABLE COMMENTS

Opportunity BI Publisher Proposals S_OPTY_XM Search Specification set to : [Type] = "BIP"

Business Components Fields

BUSINESS COMPONENT FIELDS

NAME CALCULATED

VALUE JOIN COLUMN

FORCE

ACTIVE

LINK

SPEC PICKLIST DEFAULT

Attachment Id

X_ATTACHMENT_ID Y N

Language Id X_LANG_ID Y N

Language Name

Report Language

LANG_CD N N

PickList Language

Name NAME N N Field: 'Id'

Opportunity Id

PAR_ROW_ID Y Y

Output Type X_OUTPUT_TYPE N N XMLP Proposal Output Type

Proposal Attachment

FILE_NAME Y N

Proposal Name

[Template] +

"_" + [Id] + "." +

[Output Type]

N N

Page 15: White Paper - Using BI Publisher for Siebel Proposals

Oracle White Paper— Using BI Publisher for Siebel Proposals

13

Query Spec X_QUERY_SPEC N N

Template X_TEMPLATE N N

BI Publisher Proposals Report PickList

Template Id X_TEMPLATE_ID N N

BI Publisher Proposals Report PickList

Type TYPE N N BIP

Table

TABLE COLUMNS (S_OPTY_XM)

COLUMN TRANSLATE TRANSLATION

TABLE NAME

TYPE DEFAULT LOV TYPE LOV BOUNDED

X_ATTACHMENT_ID Varchar(15)

X_LANG_ID Varchar(15)

X_OUTPUT_TYPE Y S_LST_OF_VAL Varchar(50)

XMLP_PROP

OSAL_OUTPU

T_TYPE

Y

X_QUERY_SPEC Varchar(255)

X_TEMPLATE Varchar(100)

X_TEMPLATE_ID Varchar(15)

Business Objects

BUSINESS OBJECT

NAME COMMENTS

Opportunity Added Business Component „Opportunity BI Publisher Proposals‟ with Link property:

Opportunity/Opportunity BI Publisher Proposals

Page 16: White Paper - Using BI Publisher for Siebel Proposals

Oracle White Paper— Using BI Publisher for Siebel Proposals

14

Link

LINK

NAME CASCADE DELETE COMMENTS

Opportunity/Opportunity BI Publisher

Proposals

Delete New parent/child link between Business

Components Opportunity and Opportunity BI

Publisher Proposals

Picklist

PICKLIST

NAME COMMENTS

XMLP Proposal Output Type New picklist which draws values from LOV Type XMLP_PROPOSAL_OUTPUT_TYPE

(Bounded = TRUE, Static = TRUE)

BI Publisher Proposals Report PickList New picklist which draws values from Report All Templates BC (Static = FALSE, Long List =

TRUE)

View

VIEW

NAME COMMENTS

Opportunity BI Publisher Proposals View Added Opportunity BI Publisher Proposals List Applet.

Workflow Process

WORKFLOW PROCESS

NAME COMMENTS

BIP Create Report Output Business Object: Report Output

Inserts new record into „Report Output BC‟

BIP Report Generation Calls the „GenerateBIPReport‟ method in „XMLP Driver Service‟

Page 17: White Paper - Using BI Publisher for Siebel Proposals

Oracle White Paper— Using BI Publisher for Siebel Proposals

15

Calls the „BIP Create Report Output‟ sub-process.

Business Service

BUSINESS SERVICE

NAME COMMENTS

BIP Proposals Generic business service for creating reports and attaching to an entity based on inputs

BUSINESS SERVICE SERVER SCRIPT

function Service_PreInvokeMethod (MethodName, Inputs, Outputs)

{

if (MethodName == "AttachBIPReport")

{

AttachBIPReport(Inputs,Outputs);

return (CancelOperation);

}

if (MethodName == "ExecuteBIPReport")

{

ExecuteBIPReport(Inputs,Outputs);

return (CancelOperation);

}

return (ContinueOperation);

}

function LogFile(sFile)

{

//Note the directory path below needs to be modified accordingly to an existing path to avoid error

var MyFile = Clib.fopen("D:\\21219\\tempdir\\BIPProposals_BS_Log.txt", "at");

var sTime = Clib.ctime(Clib.time());

Clib.fputs(sTime + ": " + sFile + "\n", MyFile);

Clib.fclose(MyFile);

}

function CleanUpDoc(xFileName)

{

//Code to clean up temp file system

Page 18: White Paper - Using BI Publisher for Siebel Proposals

Oracle White Paper— Using BI Publisher for Siebel Proposals

16

LogFile("CleanUpDoc. 10. Now deleting temp file - " + xFileName);

Clib.remove(xFileName);

}

function AttachBIPReport(Inputs, Outputs)

{

/*

Given a Report Id, pulls the merged document out of the File System and returns the path to the file

GetFile - The GetFile method copies a file in the Siebel File System that is attached to the current record into a temporary directory. The

method returns the path to the file in the temporary directory. The temporary directory is defined in the cfg file for the Siebel application as the

value of the TmpDir parameter in the [Siebel] section. This method allows a user to view or edit a file attachment.

Inputs: Report Id

Outputs: The full path to the file name, attaches Report document to an entity

*/

try

{

LogFile("AttachBIPReport. 10. Starting");

var sReportId = Inputs.GetProperty("Report Id");

var sOutputName = Inputs.GetProperty("Output Name");

var sEntityId = Inputs.GetProperty("Entity Id");

var sEntityParentField = Inputs.GetProperty("Entity Parent Field");

var sEntityName = Inputs.GetProperty("Entity Name");

var sEntityObj = Inputs.GetProperty("Entity Object");

var sEntityPrimary = Inputs.GetProperty("Entity Primary");

var sEntityAttachBCFileNameField = Inputs.GetProperty("Entity Filename Field");

//var sProposalName = Inputs.GetProperty("Propsosal Name");

var boReport = TheApplication().GetBusObject("Report Administration");

var bcReportOutput = boReport.GetBusComp("Report Output BC");

with (bcReportOutput)

{

SetViewMode(AllView);

ActivateField("Report Name");

ActivateField("ReportOutputFileExt");

Page 19: White Paper - Using BI Publisher for Siebel Proposals

Oracle White Paper— Using BI Publisher for Siebel Proposals

17

ActivateField("ReportOutputFileName");

ClearToQuery();

SetSearchSpec("Id", sReportId);

ExecuteQuery(ForwardOnly);

LogFile("AttachBIPReport. 20. Report Id : " + sReportId);

if (FirstRecord())

{

var ReportName = GetFieldValue("Report Name");

var ReportFileExt = GetFieldValue("ReportOutputFileExt");

var ReportFileName = GetFieldValue("ReportOutputFileName");

LogFile("AttachBIPReport. 30. ReportName : " + ReportName + " ReportFileExt : " + ReportFileExt + " ReportFileName : " +

ReportFileName);

}

else

{

throw("Unable to locate a Report with Id '" + sReportId + "'");

}

var sFileName = bcReportOutput.InvokeMethod("GetFile", "ReportOutputFileName");

LogFile("AttachBIPReport. 35. GetFile : " + sFileName);

//If Success, Split the output of GetFile to just get the file path

if (sFileName.indexOf("Success") > -1)

{

var xFileName = sFileName.substring(8);

LogFile("AttachBIPReport. 40. GetFile Success xFileName : " + xFileName);

Outputs.SetProperty("xFileName",xFileName);

}//end if

else

{

throw("Unable to GetFile for Id '" + sFileName + "'");

}//end if

} // end with

Page 20: White Paper - Using BI Publisher for Siebel Proposals

Oracle White Paper— Using BI Publisher for Siebel Proposals

18

LogFile("AttachBIPReport. 50. Write to Attachment BC");

var boAtt= TheApplication().GetBusObject(sEntityObj);

var bcAtt = boAtt.GetBusComp(sEntityPrimary);

var bcEntAtt = boAtt.GetBusComp(sEntityName);

LogFile("AttachBIPReport. 51. boAtt: " + boAtt + " bcEntAtt: " + bcEntAtt + " sEntityName: " + sEntityName);

with (bcAtt)

{

SetViewMode(AllView);

bcEntAtt.SetViewMode(AllView);

ClearToQuery();

SetSearchSpec("Id", sEntityId);

ExecuteQuery(ForwardOnly);

if (!FirstRecord())

throw("Unable to locate a record with Id '" + sEntityId + "'");

} // end with

LogFile("AttachBIPReport. 55. Located record Parent entity BC");

with (bcEntAtt)

{

bcEntAtt.NewRecord(NewAfter);

var AttachmentRowId = bcEntAtt.GetFieldValue("Id");

var RetValue = bcEntAtt.InvokeMethod("CreateFile", xFileName, sEntityAttachBCFileNameField, "Y");

bcEntAtt.WriteRecord();

LogFile("AttachBIPReport. 60. New record and Create File in Attachment BC");

if (RetValue.indexOf("Success") > -1)

{

LogFile("AttachBIPReport. 70. Attachment added to entity: " + sEntityId);

}//end if

} // end with

Page 21: White Paper - Using BI Publisher for Siebel Proposals

Oracle White Paper— Using BI Publisher for Siebel Proposals

19

Outputs.SetProperty("AttRowId", AttachmentRowId);

LogFile("AttachBIPReport. 80. Attachment ROWID: " + AttachmentRowId);

//return the ROW_ID of the attachment record to relate the BIP proposal to the attachment

LogFile("AttachBIPReport. 90. Calling CleanUpDoc");

CleanUpDoc(xFileName);

LogFile("AttachBIPReport. 100. End");

}

finally

{

// Release object variables

bcReportOutput = null;

boReport = null;

bcAtt = null;

bcEntAtt = null;

boAtt = null;

} // end finally

}

function ExecuteBIPReport(Inputs, Outputs)

{

/*

Given a Report Id, pulls the merged document out of the File System and returns the path to the file

GetFile - The GetFile method copies a file in the Siebel File System that is attached to the current record into a temporary directory. The

method returns the path to the file in the temporary directory. The temporary directory is defined in the cfg file for the Siebel application as the

value of the TmpDir parameter in the [Siebel] section. This method allows a user to view or edit a file attachment.

Inputs: Report Id

Outputs: The full path to the file name, attaches Report document to an entity

*/

try

{

var sPositonId = Inputs.GetProperty("Position Id");

var sLoginId = Inputs.GetProperty("Login Id");

var sQuerySpec = Inputs.GetProperty("Query Spec");

Page 22: White Paper - Using BI Publisher for Siebel Proposals

Oracle White Paper— Using BI Publisher for Siebel Proposals

20

var sViewMode = Inputs.GetProperty("View Mode");

var sOutputType = Inputs.GetProperty("Output Type");

var sReportLang = Inputs.GetProperty("Report Language");

var sTemplateName = Inputs.GetProperty("Template Name");

var sTemplateId = Inputs.GetProperty("Template Id");

LogFile("ExecuteBIPReport. 05. Query Spec: " + sQuerySpec + " sTemplateName: " + sTemplateName + " sTemplateId: " + sTemplateId);

LogFile("ExecuteBIPReport. 10. Start");

LogFile("ExecuteBIPReport. 11. Get report template name and related IO details");

var reportBO = TheApplication().GetBusObject("Report Administration");

var reportBC = reportBO.GetBusComp("Report All Templates BC");

reportBC.ActivateField("Report Name");

reportBC.ActivateField("Integration Object Name ");

reportBC.ActivateField("ReportTmplFileName");

reportBC.ClearToQuery();

reportBC.SetSearchSpec("Id", sTemplateId);

reportBC.ExecuteQuery(ForwardOnly);

if (reportBC.FirstRecord())

{

var sReportName = reportBC.GetFieldValue("Report Name");

var sPrimaryIO = reportBC.GetFieldValue("Integration Object Name");//PrimaryIO

var sRepTmplFileName = reportBC.GetFieldValue("ReportTmplFileName");//rtf name

}

else

{

LogFile("ExecuteBIPReport. 12. Cant find report template");

}

reportBC = null;

LogFile("ExecuteBIPReport. 15. Creating new record in Report output BC");

var reportBC = reportBO.GetBusComp("Report Output BC");

Page 23: White Paper - Using BI Publisher for Siebel Proposals

Oracle White Paper— Using BI Publisher for Siebel Proposals

21

var currentDate = new Date;

var genDate;

Clib.strftime(genDate, "%m/%d/%Y %H:%M:%S", currentDate);

reportBC.NewRecord(NewAfter);

reportBC.SetFieldValue("Owner Id", sLoginId);//psInput LoginId()

reportBC.SetFieldValue("ReportOutputFileName", sReportName);//psInput

reportBC.SetFieldValue("Time Generated", genDate);

var Id = reportBC.GetFieldValue("Id");

reportBC.SetFieldValue("Report Name", sReportName + "_" + Id);////psOutput obtain to attach

reportBC.WriteRecord();

Outputs.SetProperty("Report Output Name", sReportName + "_" + Id);

Outputs.SetProperty("Report Output Id", Id);

reportBC = null;

reportBO = null;

LogFile("ExecuteBIPReport. 20. Report Output Name: " + sReportName + "_" + Id + " Report Output Id: " + Id);

LogFile("ExecuteBIPReport. 30. Generating Report Start");

var bs = TheApplication().GetService("XMLP Driver Service");

var inpargs = TheApplication().NewPropertySet();

inpargs.SetProperty("LDAPEnabled","False");

inpargs.SetProperty("MethodName","GenerateBIPReport");

inpargs.SetProperty("TimeZone","(GMT-08:00) Pacific Time (US & Canada)");

inpargs.SetProperty("ReportTemplateId",sTemplateId);//psInput

inpargs.SetProperty("ReportOutputId",Id);//psInput

inpargs.SetProperty("ReportOutputType",sOutputType);//psInput

inpargs.SetProperty("BCViewMode",sViewMode);//psInput

inpargs.SetProperty("PositionId", TheApplication().PositionId());//psInput

inpargs.SetProperty("Synchronous","No");

Page 24: White Paper - Using BI Publisher for Siebel Proposals

Oracle White Paper— Using BI Publisher for Siebel Proposals

22

inpargs.SetProperty("ReportName",sReportName);//psInput

inpargs.SetProperty("TemplateName",sRepTmplFileName);//psInput

inpargs.SetProperty("LanguageCode",sReportLang);//psInput

inpargs.SetProperty("ReportOutputLang",sReportLang);//psInput

inpargs.SetProperty("ReportOutputLocale",sReportLang);//psInput

inpargs.SetProperty("IntegrationObject",sPrimaryIO);//psInput

inpargs.SetProperty("LoginId",sLoginId);//psInput

inpargs.SetProperty("BIPUserId","SADMIN");//Siebel username/password - depends on BIP security model

inpargs.SetProperty("BIPPassword","MSSQL");//Siebel username/password - depends on BIP security model

inpargs.SetProperty("Bookmark",sQuerySpec);//psInput Bookmark

inpargs.SetProperty("ReportSelected",sReportName);//psInput

var outargs = TheApplication().NewPropertySet();

LogFile("ExecuteBIPReport. 45. GenerateReport method start");

bs.InvokeMethod("GenerateBIPReport",inpargs,outargs);

// at this point the report could take a long time to generate only way to tell is to requery BC until report row_id = success

LogFile("ExecuteBIPReport. 50. End of BIP execution");

return (CancelOperation);

}

finally

{

// Release object variables

reportBC = null;

reportBO = null;

bs = null;

inpargs = null;

outargs = null;

} // end finally

}

Page 25: White Paper - Using BI Publisher for Siebel Proposals

Oracle White Paper— Using BI Publisher for Siebel Proposals

23

Testing

This solution assumes a working Siebel BI Publisher integration already exists. It is useful to test

the Report Business Service using the Workflow Process through the Business Service Simulator.

Workflow Process

To test using the Workflow Process, once deployed, follow the steps below:

1. Navigate to the „Administration – Business Service‟ view. Click on „Simulator‟

2. Import file „WF Process Simulator Service.xml‟ into the Service Name applet.

3. Import file ‟ WF Process Simulator Arguments.xml‟ into the Input Arguments applet,

change arguments as required

4. Click „Run‟.

5. The report output should be created in the „My BI Publisher Reports‟ view.

If the report generation works successfully through the Business Service Simulator but not

through the button click solution, it might be useful to check the following:-

Value used in the Query String should be in the correct syntax

The input parameters in Applet Server Script might not be specified correctly

Make sure the Report template already exists. If using „Auto Proposal‟ check the default

values in the script are valid, especially for Template Name and Template Id.

Page 26: White Paper - Using BI Publisher for Siebel Proposals

Using BI Publisher for Siebel Proposals

September, 2011

Author: John Bedford

Oracle Corporation

World Headquarters

500 Oracle Parkway

Redwood Shores, CA 94065

U.S.A.

Worldwide Inquiries:

Phone: +1.650.506.7000

Fax: +1.650.506.7200

oracle.com

Copyright © 2009, Oracle and/or its affiliates. All rights reserved. This document is provided for information purposes only and

the contents hereof are subject to change without notice. This document is not warranted to be error-free, nor subject to any other

warranties or conditions, whether expressed orally or implied in law, including implied warranties and conditions of merchantability or

fitness for a particular purpose. We specifically disclaim any liability with respect to this document and no contractual obligations are

formed either directly or indirectly by this document. This document may not be reproduced or transmitted in any form or by any

means, electronic or mechanical, for any purpose, without our prior written permission.

Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective

owners.

0109