Professional Documents
Culture Documents
Guide
BusinessObjects XI 3.1
Copyright © 2008 Business Objects, an SAP company. All rights reserved. Business Objects
owns the following U.S. patents, which may cover products that are offered and
licensed by Business Objects: 5,295,243; 5,339,390; 5,555,403; 5,590,250;
5,619,632; 5,632,009; 5,857,205; 5,880,742; 5,883,635; 6,085,202; 6,108,698;
6,247,008; 6,289,352; 6,300,957; 6,377,259; 6,490,593; 6,578,027; 6,581,068;
6,628,312; 6,654,761; 6,768,986; 6,772,409; 6,831,668; 6,882,998; 6,892,189;
6,901,555; 7,089,238; 7,107,266; 7,139,766; 7,178,099; 7,181,435; 7,181,440;
7,194,465; 7,222,130; 7,299,419; 7,320,122 and 7,356,779. Business Objects and
its logos, BusinessObjects, Business Objects Crystal Vision, Business Process
On Demand, BusinessQuery, Cartesis, Crystal Analysis, Crystal Applications,
Crystal Decisions, Crystal Enterprise, Crystal Insider, Crystal Reports, Crystal
Vision, Desktop Intelligence, Inxight and its logos , LinguistX, Star Tree, Table
Lens, ThingFinder, Timewall, Let There Be Light, Metify, NSite, Rapid Marts,
RapidMarts, the Spectrum Design, Web Intelligence, Workmail and Xcelsius are
trademarks or registered trademarks in the United States and/or other countries
of Business Objects and/or affiliated companies. SAP is the trademark or registered
trademark of SAP AG in Germany and in several other countries. All other names
mentioned herein may be trademarks of their respective owners.
Third-party Business Objects products in this release may contain redistributions of software
Contributors licensed from third-party contributors. Some of these individual components may
also be available under alternative licenses. A partial listing of third-party
contributors that have requested or permitted acknowledgments, as well as required
notices, can be found at: http://www.businessobjects.com/thirdparty
2008-09-11
Contents
Chapter 1 Introduction 7
About this guide...........................................................................................8
Who should use this guide ....................................................................8
Business Objects information resources................................................8
API changes..............................................................................................23
Deprecated APIs and their replacements............................................23
New interoperability in XI......................................................................26
OLAP data access with universes........................................................26
Application-level variables....................................................................27
Use cases..................................................................................................28
Scheduling by using DocAgentOption class........................................28
BCA custom macro migration...............................................................29
Document events, properties, and methods..............................................30
Event-related restrictions .....................................................................32
Other limitations...................................................................................33
Index 71
1
1 Introduction
About this guide
This guide is intended for developers who want to use the Desktop
Intelligence SDK to develop applications.
For more information and assistance, see Appendix A: Get More Help. This
appendix describes the Business Objects documentation, customer support,
training, and consulting services, with links to online resources.
2
2 Getting started with VBA
Accessing the development environment
You can use Microsoft Visual Basic for Applications (VBA) to create custom
macros and add-ins in Desktop Intelligence.The VBA is used by Microsoft
Office products and several other Windows software products. Using VBA,
you can integrate and customize applications that are already available on
the system desktop. However, you may encounter some limitations while
using VBA on the Desktop Intelligence server. For more information, see
VBA macros: migration overview on page 19.
This chapter describes how VBA enables you to extend the capabilities of
Desktop Intelligence. This chapter also describes how to develop macros
and add-ins by using VBA, to control the Desktop Intelligence and Designer
environments, as well as perform queries and analysis on data in documents
through universes and data providers.
The Visual Basic editor is the standard Microsoft VBA editor, which is included
in the Microsoft Office 2000 suite. Hence, you can use tools such as Object
Browser and Project Explorer. Online help for VBA is also available from the
Visual Basic editor.
Language summary
This section provides an overview of the VBA language. It also discusses
some of the key features of VBA language.
For information about Visual Basic and VBA, see the Microsoft documentation.
Variables
Procedures
Event implementation
The VBA is event-driven, that is, the code is executed when certain events
take place in the application. Examples of events include a user opening a
document and a user clicking a button. The execution of the code when an
event occurs is called event implementation.
The Universe Designer SDK does not have any events to implement. This
implies that you cannot write a code to respond to events in the Designer
application. However, you can use the Designer object model while
implementing events of other applications.
Flow control
The following table discusses the most commonly used VBA flow control
structures:
Control Description
Arrays
Declaring an array
Array indexes
By default, the first element of an array is element 0 and the last is n. You
can change the array elements by using Option Base statement.
For example:
Option Base 1
Array(1) 'reference the first element
RawData has 11 elements. The first is element number 10 and the last is
element number 20.
With statement
.DuplicateRows = TRUE
.DeleteTrailingBlanks = TRUE
.ScopeOfAnalysis = boThreeLevelsDown
End With
Error handling
You can use the On Error statement to handle errors generated during the
execution of a code.
If you don't use an On Error statement, any run-time error that occurs can
prove to be critical. That is, an error message is displayed and the execution
stops.
Note:
This statement can hinder debugging.
The Object Browser displays all the programmable objects that are installed
and registered on the system along with their associated properties, methods,
and events. You can also use the Object Browser to browse the procedures
and module-level variables in your own VBA projects.
To open the Object Browser, select Object Browser from the View menu.
To refer to an external object library from VBA, complete the following steps:
1. In the Tools menu, select References….
If the reference is successful, the name of the object library you referenced
appears in the Object Library drop-down list in the VBA Object Browser.
2. Select the object library from the list, and click OK.
Name Description
Name Description
3
3 VBA macros: migration overview
Migration of VBA macros to XI
Note:
Unless specifically mentioned, XI R2 and XI 3.x are collectively referred to
as XI.
• A direct migration path and a set of migration tools for customers who
have deployed BusinessObjects 5.1 (or Web Intelligence 2.7), 6.0, 6.1,
or 6.5.
• Desktop Intelligence: The BusinessObjects full client (which is renamed
as Desktop Intelligence) is part of XI. It benefits from the enhancements
in the new platform, such as Unicode support, report instances, and
discussions.
• Web Intelligence: XI provides a much-enhanced version of Web
Intelligence, which enables a large number of customers to move their
entire business intelligence (BI) solution to the web.
The VBA macros or add-ins developed for 5.1/6.x work with Desktop
Intelligence supported in XI. Most VBA macros developed for 5.1/6.x work
in XI. However, some macros are not supported on the server side.
Support depends on the nature of the code and the location of the code
execution. The following table discusses support for VBA macros in XI:
VBA macros
The VBA macros are embedded in .rep documents. You can migrate .rep
documents to XI in one of the following ways:
• Corporate documents (that is, .rep documents located in the source
repository) can be migrated to the XI repository by using the Import Wizard
tool.
• Local documents (that is, .rep documents located on the desktop of the
systems) can be migrated to XI by opening and saving these documents
with Desktop Intelligence.
In both cases, after migration, VBA macros remain embedded in .rep
documents in XI.
VBA add-ins
Each VBA add-in is a separate file with a .rea (report add-in) extension. The
VBA add-ins do not run on the server side (that is, on the BusinessObjects
Enterprise server) in XI.
The macros that work at the document level (for example, macros that
execute queries, filter a report, or re-format a report) continue to work in XI.
Related Topics
• Scheduling by using DocAgentOption class on page 28
Import Wizard is a migration tool that enables you to move content from
5.1/6.x to an XI repository. However, the Import Wizard does not check VBA
code contained in .rep documents and whether the VBA macros must be
updated or not. Hence, after migration, VBA macros must be checked and
validated manually.
Some customers store VBA add-ins in the 5.1/6.x repository. Like agnostic
documents, the VBA add-ins (.rea files) are migrated by using the Import
Wizard. Hence, these add-ins are copied to the XI repository.
Server-side execution
API changes
Some APIs have been removed while others have been updated (with a new
operability defined in XI). This section discusses changes in the APIs.
The following tables discuss the APIs that are deprecated and the APIs that
are introduced as replacements:
Login
Function
Application.LogonDialog ()As
Boolean
Document exchange
Sub Document.SaveToEnter-
Sub Document.Send([User As prise(Folder As string, CategoryList
String], [StoreGeneratedHTML As As String, Overwrite As Boolean)
Boolean], [HtmlLayout As BoHTML-
Sub Document.SaveToEnterpriseDi-
Layout], [CategoryList As String],
alog()
[ExchangeMode As BoExchange-
Mode], [ExchangeDomain As String]) Note:
Send to inbox and scheduling are not
HtmlLayout obsolete with dhtml available in Destkop Intelligence SDK.
viewer You must use the BOESDK destination
plug-in.
Application.BoExchangeMode
Function
Documents.OpenFromEnter-
pris(Name As String, Folder, As
String) As Document
Function
Sub Documents.Receive([Name As
String], [DestDir As String]) Documents.OpenFromEnterpriseDia-
log() As Document
Function
Sub Documents.Receive([Name As Documents.OpenFromEnterpriseDia-
String], [DestDir As String]) log(DocumentOrigin As BODocumen-
tOrigin) As Document
Application.BoExchangeModeDistinct
method replace echange mode Appli-
No replacement in XI
cation.ExchangeDomain Folders su-
persede domains
Scheduling
Function DataProviders.AddQuery
Function AddQueryTechnique(Uni-
Technique(UniverseName As String,
verseName As String, EnterpriseFold-
[UniverseDomainName]) As DataPro-
erName As String)
vide
Property Universes.Item(Index As
Variant, [RepositoryName As String]) No replacement in XI
As Universe ®)
Universe.DomainName No replacement in XI
New interoperability in XI
In XI, you can build universes on top of MS Analysis Services, Essbase, and
SAP BW cubes. Hence, the OLAP data provider is removed from Desktop
Intelligence and the SecurityPrompts class is obsolete.
Note:
Desktop Intelligence documents support only SAP BW universes.
Sub Application.SetSecuri
tyPrompt(sUserName As String,
sUserPasswordVarName As String,
No replacement in XI
sUserPassword As String, sDBName
As String, sDBPasswordVarName
As String, sDBPassword As String)
Function Document.GetSecuri
No replacement in XI
tyPrompts() As Security Prompts
Application-level variables
BOLANGUAGE
BOSECURITYDOMAIN
6.5 variables available in XI
BOUSER
BUSER_UPPER
COMPUTERNAME
CommonProgramFiles
HOMEDRIVE
HOMEPATH
ProgramFiles
SystemRoot
USERDNSDOMAIN
USERDOMAIN
USERNAME
USERPROFILE
Use cases
This section briefly describes the use cases of Desktop Intelligence SDK.
A use case for BCA Custom Macro is the Automatic distribution through
email of BusinessObjects documents in PDF format.
The following are the two options to migrate from 6.5 to XI:
• Option 1:
1. Move the code from VBA to a VB Program.
2. Install Desktop Intelligence on the same machine as the
BusinessObjects XI Server.
3. Use InfoView or BusinessObjects Enterprise SDK to schedule the VB
program object. For more information, see Scheduling by using
DocAgentOption class on page 28.
• Option 2:
1. Call VBA ENotify () in document event handler: Sub
Document_AfterRefresh()
2. Use InfoView or BusinessObjects Enterprise SDK to schedule
publisher.rep refresh. For more information, see Scheduling by using
DocAgentOption class on page 28.
Open OK OK
BeforeRefresh OK OK
AfterRefresh OK OK
ThisDocument OK OK
ThisDocument.SaveToEn
Doesn't work OK
terprise
ThisDocument.Expor
OK OK
tAsPDF
ThisDocument.Expor
OK OK
tAsXML
Event-related restrictions
Event Description
Other limitations
Testing limitations
For example, pass the value through SDK on both BeforeRefresh and
AfterRefresh events. Consider, Country = US.
1. Click Refresh.
2. Select a value from LOV when prompted.
3. Set a different value (for example, Country = France) using SDK.
4. Run the report.
The data relative to US is displayed even if you manually select France.
RE SDK protocol
When you perform any of the operations discussed in this section, the report
in the viewer and the actual report in the server do not match.
For example, pass the value through SDK on BeforeRefresh event for
the prompt. Consider, Country = US.
• Any operation that changes the report map (use different prompt)
Operations on the viewer, such as trying to open a report map entry that
does not exist, give inconsistent results, or may fail.
Note:
The following functions may not work on both BeforeRefresh and AfterRefresh
events:
• Opening a new document
• Performing operations such as refresh, edit, close, and so on, in a new
document
• Creating a new application from an existing application
The Desktop Intelligence server does not support opening multiple documents
in a process. Hence, these operations are not implemented.
4
4 Programming with Desktop Intelligence
Macros and subroutines
You can create macros in Desktop Intelligence by using the integrated VBA
environment.
Creating a macro
In the "Macros" dialog box, the names of add-ins, the macros contained
in the open document, or a combination of both is displayed.
3. Enter a name for the macro, and click Create. The VBA environment is
opened, and a module containing a skeleton sub-routine for the macro
is created, as shown in the following figure:
When you finish writing and compiling the macro successfully, select Close
and Return to Desktop Intelligence from the File menu. You can now run
the macro from the "Macros" dialog box. If you want, you can also associate
the macro with a button on the tool bar. For more information, see
Customizing the user interface on page 49.
You can hide or show the Visual Basic tool bar in Desktop Intelligence by
right-clicking another tool bar or the menu bar, and selecting Visual Basic.
You can also select Toolbars from the View menu, as shown in the following
figure:
On the Visual Basic tool bar, you can associate up to five buttons with a
macro.
3. Click the check box besides the number of the button with which you want
to associate the macro.
4. Type the name of the macro in the text box to the right. Alternatively, you
can click Browse besides the text box to select a macro. When a macro
is selected, the edit box displays AddIn.rea!module.macro or
Document.rep!module.macro.
5. Enter a tool tip for the macro (optional).
6. Click OK.
Add-ins
Add-ins are programs that provide optional commands and features to
Desktop Intelligence. Each add-in is saved with a .rea extension.
Before you can use an add-in, you must load it on your computer and then
install it in Desktop Intelligence. Once you install an add-in, it becomes
available each time you launch Desktop Intelligence.
You can distribute add-ins you have created to other users, and retrieve and
use add-ins that others have created.
Note:
Starting with XI, the add-ins are not supported when a Desktop Intelligence
document is used on the server to perform any of the following tasks:
• refreshing
• scheduling
• publishing
Creating an add-in
You can create add-ins in Desktop Intelligence, and distribute them among
other users or save them to BusinessObjects Enterprise.
Tip:
To optimize the performance of the system, use one large .rea file containing
many subroutines, rather than using multiple .rea files.
To install an add-in, you must save it on the computer and then install it in
Desktop Intelligence.
3. Click the check box of the add-in you want to install. If it is not displayed
in the "Add-Ins" dialog box, click Browse to search.
4. Click OK.
You can run an installed add-in from the Macros dialog box, or you can
associate it with a button on the Visual Basic tool bar. For more information,
see Customizing the user interface on page 49.
General document events, those that apply to any document, belong to the
Application class and are called application events.
The following table lists the application events and document events that
you can implement in Desktop Intelligence:
DocumentActivate Activate
DocumentAfterRefresh AfterRefresh
DocumentBeforeClose BeforeClose
DocumentBeforeRefresh BeforeRefresh
DocumentBeforeSave BeforeSave
DocumentDeactivate Deactivate
DocumentOpen Open
NewDocument
Event triggers
Implementing an event
Each event that you can implement appears in the VBA procedure list for its
corresponding object.
To implement an event, insert the code that you want to execute in the
procedure corresponding to the event when the event occurs.
The events for the application reference property appear in the procedure
drop-down list in the code window of the class module you created in
step 1.
The events for the application reference property (boapp) appear in the
procedure list of the application reference class (AppRefClass).
Public
WithEvents boapp As Application
The Public part of the declaration makes the property globally available.
The WithEvents part of the declaration enables you to access the events
defined for the Application class. For more information on the Public and
WithEvents keywords, see the Visual Basic documentation.
Dim AppRef As
New AppRefClass
Sub Initialize()
Set AppRef.boapp = Application
...
End
Sub
5
5 Customizing the user interface
User interface classes
This chapter describes how to customize the user interface by using the
Desktop Intelligence SDK.
Command Bars
A command bar can be a tool bar, a menu bar, or a pop-up menu. For
information about adding tool bars and pop-up menus to the Desktop
Intelligence user interface, see Adding a command bar on page 53.
Command bars include controls that can be either a pop-up menus or buttons.
Controls
Following are the types of controls: pop-up menus and buttons. Pop-up
menus present the list of buttons that can be used to perform actions, as
shown following figure:
The CmdBarControls collection contains all the controls for a command bar.
Nested controls
Pop-up controls can contain other controls, as shown in the following figure:
When pop-up controls contain other controls, they act as command bars.
The pop-up controls have their own collection of controls that you can access
by using CmdBarPopup.Controls.
After you have added a command bar, you must add controls that enable
users to access the functions you provide. For more information about adding
controls, see Adding controls to a command bar on page 54.
After you have defined the controls for a pop-up menu, use
CmdBar.ShowPopup to display the pop-up menu, as follows:
popup.ShowPopup
A face is the image that appears on the button. Faces are also called icons.
Without a face, a button appears blank and is indistinguishable from the
surface of its command bar (and similarly, without any buttons, a command
bar appears as a thin line).
To add a face to a button, create the button and use the Clipboard object to
hold the file containing the face. The Clipboard object enables you to access
the system clipboard, which can contain one image and one block of text.
Once the face is in the clipboard, you can add (paste) it to the button.
To add the face to the clipboard, use the standard VBA function LoadPicture(),
which returns an object of the type StdPicture. For more information about
adding faces to buttons, see the Visual Basic documentation.
You can use VBA to create your own forms. Visual Basic includes a rich set
of programming tools for creating forms visually and defining the behavior
of the form and its controls by using events—for example, double-click,
pressing a key, and moving the mouse.
Creating a form
6
6 Data providers
Working with existing data providers
This chapter discusses the concepts associated with creating data providers
by using the Desktop Intelligence SDK. It discusses the different types of
data providers and describes how to access these sources of data.
Only data providers that are created from universes have a Queries object.
For more information about the Queries class, see Query technique on
page 62.
The columns in the Results tab of the "Data Manager" dialog box are the
same columns that you can access by using the Columns class.
Sub Show_DP_Names()
Dim I As
Integer
Dim message As
String
For I = 1 To Application.ActiveDocument.Dat
aProviders.Count
message = message & Chr(10) &
Application.ActiveDocument.DataProviders.Item(I).Name
Next
MsgBox message 'display the names
End Sub
You can select and configure the data provider by using the New Data wizard
or the New Report wizard. If editing is enabled for the data provider, you can
edit the data provider by using the Desktop Intelligence interface.
For information on creating data providers with the Desktop Intelligence SDK,
see Creating a query technique on page 65.
Query technique
A query technique is a data provider that queries a universe. You can use
the Desktop Intelligence Query Panel to create a query technique data
provider.
The query technique data provider consists of the following:
• universe
• query
The universe part defines where the information comes from. For example,
the eFashion universe is stored in the General repository. This corresponds
to choosing the universe in the New Report wizard.
The query part defines which parts of the universe you are interested in. For
example, the Year object of the Time period class, and the Sales revenue
object of the Measures class, where Year is equal to 2000.
Freehand SQL
A freehand SQL data provider is one in which the data is retrieved by using
an SQL statement and the database connection is defined by the end user.
A personal text file data provider retrieves data from plain text, Microsoft
Excel, and dBASE files. You can use the personal text file option to configure
the information in the file, such as what is a value, what is a column name
and so on.
Stored procedure
A stored procedure data provider is an SQL script that is saved and executed
in a database.
A stored procedure data provider has no Queries object.
You can load and unload a DataProvider object to and from memory as
follows:
• To load a DataProvider object into memory, use DataProvider.Load
• To unload a DataProvider object from memory, use DataProvider.Unload
Error handling
If you do not unload a data provider from memory after using it, it will slow
down the system and the program may terminate unexpectedly.
Sub Modify_DataProvider()
Dim boDP As DataProvider
On
Error
Goto DPError 'if there's an error handle it
Set boDP = Application.ActiveDocument.Dat
aProviders.Item(1)
boDP.Load 'load the data provider into memory
... 'do some processing with the data provider
boDP.Unload 'unload the data provider from memory
...
Exit
Sub
DPError:
boDP.Unload 'make sure that the data provider is not
in memory
From this point, just as in the user interface, you can choose objects for the
results and conditions, apply sorts, and run the query. The object model
includes a number of classes for this, all of which can be accessed through
the Queries object.
A
A Get More Help
http://www.businessobjects.com/support/
For more information, contact your local sales office, or contact us at:
http://www.businessobjects.com/services/consulting/
http://www.businessobjects.com/services/training
mailto:documentation@businessobjects.com
Note:
If your issue concerns a Business Objects product and not the documentation,
please contact our Customer Support experts. For information about
Customer Support visit: http://www.businessobjects.com/support/.
D executing macros 40
external object libraries 15
data providers 60
freehand SQL 63
handling errors 64
F
loading and unloading 64 faces
optimizing 64 adding 55
personal text file 63 recommended size 56
query technique 62 filling a microcube 66
stored procedure 63 flow control
types 62 in VBA 12
dBASE forms
querying 63 creating 57
declaring freehand SQL data provider
arrays in VBA 13 definition 63
variables in VBA 11 functions 11, 16
Desktop Intelligence
customizing the interface 50
development environment H
VBA 10, 15
disabling handling
macros 38 errors in VBA 14
displaying pop-up menus 54
distributing I
add-ins 42
document events 44, 45 implementing
form events 57
implementing events 11, 45
E including
errors external object libraries in VBA 15
data providers 64 indexing
handling 64 arrays in VBA 13
handling in VBA 14
events L
application 44
document 44, 45 loading
form 57 data providers 64
implementing 11, 45
order 45
triggers 45
M
Excel macros 10
querying 63 adding 40
macros (continued) Q
creating 38
running 40 Queries object 65
tool tips 40 Query Panel 65
memory management query technique data provider
data providers 64 creating 62, 65
menu bar definition 62
definition 51 running and refreshing 66
menus
nesting 52
microcube
R
filling 66 referencing
external object libraries in VBA 15
N refreshing
query technique data provider 66
nesting controls 52 reports 66
repository 62
running
O macros 40
Object Browser 10 query technique data provider 66
opening 15
object models S
user interface 50
objects showing pop-up menus 54
browsing in VBA 15 SQL 66
external 15 data provider 63
On Error statement 14 stored procedure data provider
optimizing definition 63
data providers 64 sub-routines 11, 38
P T
personal text file data provider tool bars
definition 63 adding 53
pop-up menus definition 51
adding 53 tool tips
definition 51 macros 40
displaying 54
nesting 52
procedures 11
browsing in VBA 15
U VBA (continued)
functions 16
universes implementing an event 45
querying 62, 65 language summary 10
unloading On Error statement 14
data providers 64 variables 11
user input 50 With statement 14
user interface writing macros 38
customizing 50 VBA procedure data provider
creating 62
Visual Basic
V editor 10, 40
VBA 10 tool bar 40
arrays 13
creating forms 57 W
data types 11
events 11 With statement 14
flow control 12