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 sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calling Business Objects from VB, setting conditions

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hi, I'm setting up a VB application that opens Business Objects and automatically runs a report. I've figured out how to refresh the report using VB, however I'd like to either: create a new condition on the report, or automatically pass the parameter from VB into a prompt. I've had a look at the assocaited help files but they don't go into too much depth.

Please help...
 
Hi Matt,

I have asked a similar Q before and I got this code:

Dim Obj_BOApp As busobj.Application
Dim Obj_BODoc As busobj.Document
Dim Obj_BORep As busobj.Report


Dim Obj_AppVariable As busobj.Variable


Private Sub RefreshReports_Click()
On Error Resume Next
Set Obj_BOApp = New busobj.Application
If Err.Number <> 0 Then
Call MsgBox(Err.Description, vbCritical)
Else
'We don't want to see the application
Obj_BOApp.Visible = False
'We don't want any interaction
Obj_BOApp.Interactive = False
'We open Business Objects with the login/password from the Form
On Error Resume Next
Call Obj_BOApp.LoginAs(Login.Text, Password.Text, Offline.Value, BOMain.Text)
If Err.Number <> 0 Then
Call MsgBox(Err.Description, vbCritical)
Else
OpenRefreshExportDoc (&quot;C:\Doc1.rep&quot;)
OpenRefreshExportDoc (&quot;C:\Doc2.rep&quot;)
End If
Obj_BOApp.Quit
End If
End Sub


Private Sub OpenRefreshExportDoc(DocPath As String)
Dim VarMonth As busobj.Variable


On Error Resume Next
'We open the document
Set Obj_BODoc = Obj_BOApp.Documents.Open(DocPath, False, False)
If Err.Number <> 0 Then
Call MsgBox(Err.Description, vbCritical)
Else
'We create the variable that is actually the exact Label of your prompt
Set VarMonth = Obj_BOApp.Variables.Add(&quot;Month?&quot;)
'We set the value
VarMonth.Value = InputBox(&quot;What value for your month?&quot;, &quot;Month&quot;)
'We refresh the document
On Error Resume Next
Obj_BODoc.Refresh
If Err.Number <> 0 Then
Call MsgBox(Err.Description, vbCritical)
Else
'We export all reports in the document to a text file
For Each Obj_BORep In Obj_BODoc.Reports
Obj_BORep.ExportAsText (&quot;C:\&quot; & Obj_BODoc.Name & &quot;_&quot; & Obj_BORep.Name & &quot;.txt&quot;)
Next
End If
VarMonth.Delete
Obj_BODoc.Close
End If
End Sub&quot;


HTH,

Nick
 
Hello Matt,


Can u pls tell me how can u run BO reports from VB 6.0

Thanks
 
Just create an object as you would with other applications...

Sample code:
Sub Main()
Dim App As Busobj.Application
Set App = CreateObject(&quot;BusinessObjects.Application&quot;)
Call App.LoginAs(&quot;TheUserName&quot;, &quot;ThePassWord&quot;, False, &quot;BOMain&quot;)
App.Interactive = True
App.Visible = True

etc.

End Sub

For Login Parameters, you are using TRUE for Offline and FALSE for connecting to the repository (With the name BOMain in this example).
Should not cause big trouble, is all mentioned clearly in the User Guide.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top