The following code snippet shows how to execute a prompted Report Services Document and export the resulting document to PDF. The code answers a value prompt
Sample Code/Error
' Find the objects
Set oComDocumentDef = oComObjSource.FindObject("8650172D48AAC1F7ED5FD8A80D95CE57", DssTypeDocumentDefinition) ' Search for the Document Object ID
Set oComPrompt = oComObjSource.FindObject("C8C7605E488A679B940503BCE11E6919", DssTypePrompt) ' Search for the value prompt ID
Set oComDocumentSource = oComSession.Component(DssRoleDocumentSource)
Set oComResolution = oComSession.ObjectSource.NewObject(DssTypeResolution, DssSourceDoNotCache)
' Execute document definition
Set objDocServer = MySession.Component(DssRoleDocumentSource)
Set objDocInstance = objDocServer.ExecuteDefinition(MyDocDef, 15, 1)
' Build prompt answer
Set oComPrompt2 = lResolution.Add(oComPrompt)
oComPrompt2.Answer = CLng(2)
oComPrompt2.Closed = True
' Answer prompts
Call objDocServer.PromptResume(objDocInstance, lResolution, MySession.UserRuntime, lngCookie)
' Execute document instance
Call objDocServer.Execute(objDocInstance, 268435457, 1)
' Export the document instance to PDF using the Export Engine
Dim abcArray() As Byte
abcArray = objDocInstance.ExportDocument(DssExportFormatPdf)
' Save as file
Dim myFile As String
myFile = "c:\temp\SDK.pdf"
Open myFile For Binary As 1 'open, put, and close the .pdf file
Put #1, 1, abcArray
Close #1
A working VB6.0 sample can be found here
ExportDocument
CUSTOMIZATION WARNING
This customization is provided as a convenience to Strategy users and is only directly applicable to the version stated. While this code may apply to other releases directly, Strategy Technical Support makes no guarantees that the code provided will apply to any future or previous builds. In the event of a code change in future builds, Strategy Technical Support makes no guarantee that an updated version of this particular customization will be provided. In the event of a code change in future builds, Strategy may not be able to provide additional code on this matter even though this customization is provided at this time for this specific build. For enhancements to this customization or to incorporate similar functionality into other versions, contact your Account Executive to inquire about Strategy consulting assistance.