Is it possible to schedule a Business Objects report using something like Windows Scheduler and / or VB to run a scheduleed Business Objects report, or is the only way to do it to use Broadcast Agent?
You can do it the way you want it to be. But stick to BCA that is more robust and do a lot of things which when you think of doing it in VB require a lot of hours to have a working copy. Still getting to BCA level is too much and not a wise choice. Its as simple as this " If the thing is available already why you want to reinvent it"
BCA cost a lot of money and some companies (like mine) won't fork out for it, because they are tightwads and want something for nothing.
To run a BO report from a scheduled task is pretty simple.
You'll need to add the code to run, refresh and save the report to the open routine of the document (i'll give you some common code if you need it)
then simply add a scheduled task including password and username.. Simple.
Some problems i encountered when i was first trying to accomplish this task were answered on Tek-Tips but i can't find the thread so i'll jot a few down here:
The command line to run the programme should read as follows: "D:\Program Files\Business Objects\BusinessObjects 5.0\BUSOBJ.EXE" -user readonly -pass readonly -nologo "F:\Business Objects\Documents\Caseholder\six monthly reviews.rep"
As you can see the first part is the programme itself, username and password - simply enter your details, nologo means the programme runs without showing BO intro screen etc.
You may find that occasionally your code will break down because the report has a problem (eg - no data) the start of your code should read
ADB1, you're right this is actually quite a straightforward bit of coding to achieve, as an example the coding i'm currently using (which i got from this site) goes like this
Private Sub Document_Open()
busobj.Application.BreakOnVBAError = False
busobj.Application.Interactive = False
Dim doc As Document
Dim rep As Report
Dim mydate As Date
Set doc = Application.Documents.Item(1)
doc.Refresh
doc.Save
Set rep = doc.Reports.Item(1)
mydate = Date
rep.ExportAsPDF ("F:\Process Support\Taps Balances\Beneficiary\Historic Posted\bene_acct_trans_post_" + Format(mydate, "dd-mm-yyyy")
Application.Quit
End Sub
There are all sorts of other options, like variable folders and saving as Excel, but as you can see the basic code used can be very simple.
There are definitely limitations with this method though, i run the scheduled task from my PC (we have a dog of a server) and on several occasions and for several reasons the reports have not run - I'm guessing the BCA is a lot more of a reliable method.
On the subject of distribution, you can add some coding that will e-mail reports to other users as part of an automated task, coding for this will depend on the e-mail system you are using
Whilst in Business Objects, go to the visual basic editor via the visual basic editor button(If this isn't visible, right click in the toolbar area and select visual basic toolbar).
You should then be presented with the visual basic window, in the left hand pane double click on your document and in the right hand pane a vba code window should appear.
The vba code window has two drop down boxes at the top, select document in the left hand drop down and then select open in the right hand drop down
You should be presented with
Private Sub Document_Open()
End Sub
The code goes between these two lines and will trigger when the document is opened.
Beware, you have an option setting in the tools menu (this is in the main bo window) that askes whether or not you want bo to ask when opening documents with macros, if you want the task sdheduler to work you will need to de-select this option...
Hi
Since i did liked to try this option, i have pasted the VB code, in my existing report and just changed the ExportAsPDF saving location to my m/c desktop. but while i try to open that particular report, i was prompted for enable/disable macro, while i pressed enable it, my bo client is getting closed. why is it happening so?
Because the auto open routine closes the application when it has run the rest of the code.
The code is for running the document automatically, if you want to open it manually (ie to change the report or code) you will need to disable the macro...
I am sorry where to include that scheduling part of the BO document. For refreshing and saving, one can use macro. How about distributing the refreshed document to other and publishing it to repository?
I am having requirement that, I need to refresh bunch of the reports and save it in the server and ftp those files to the client machines. Can we do this using VBA Macro in BO. Suppose if i get any error like "No data to fetch" how to handle this kind of problems. Please provide me the solution.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.