Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Schedule Reports 2

Status
Not open for further replies.

ADB1

Programmer
Aug 24, 2001
235
GB
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?

Thanks,

Adam.
 
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"

Sri
 
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

busobj.application.interactive = false
busobj.application.breakonvbaerror = false

this will stop that problem.

Make sure that you have the always ask before aopening documents with macros option set to no.

Good luck drop us a line on this thread if you have any queries
 
You also have no easy way to distribute reports to other users. The BCA has the distribution stuff all built-in.



Steve Krandel
Knightsbridge Solutions
formerly BASE Consulting Group
 
Thanks for the help DrSmyth.

Steve, it is simply the fact that BCA is expensive. All we want to do is run a business Objects report and save it to a location as a PDF.

I think this is possible but just need to get together the script syntax.

Thanks,

Adam.
 
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
 
Fantastic i will have a go.

Thanks for the help. I will no doubt have more questions though!

Adam.
 
Where exactly do you run the report? By this, I mean where do you place the code?

Apologies for my lack of VB knowledge!

Adam.
 
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...

Good luck...

 
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 think it sounds like basic qusetion?
 
Hi,

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.

Thanks,
Shyam.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top