cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a way to run a SAP Report from outside SAP?

Former Member
0 Kudos

Is there a way to run a SAP Report from outside SAP using a RFC or Bapi?

say for ex: i need to run RPTQTA00 using a RFC or BAPI is there a standard one or are there any FMs around which i can do a wrapper.

pls advice.

thanks

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi HRUser,

We use the object called "BackgroundJob" to run HR programs in background. HR would like the flexibility to run their schedules whenever they are ready and this BAPI does the job. I am old school so I still use VB6 but I heard VB.NET is so much easier. And you can also specify the variant and you can run any report.

I have included some of the code (using VB6) to call this BAPI. Hope this helps and Good luck.

Dim sapJob As Object

Dim sapReturn2 As Object

Dim strJobCount As String

Set sapJob = SAPBAPIControl1.GetSAPObject("BackgroundJob")

'---open background job

sapJob.Open JobName:=txtJobName, Jobcount:=strJobCount, _

ExternalUserName:=mSAPconn.User, Return:=sapReturn2

If sapReturn2("TYPE") = "E" Then

MsgBox sapReturn2("MESSAGE"), vbCritical, "Open Background Job Failed!!!"

lblJobCount = "Failed!! JobCount = " & strJobCount

lblErrorMsg = sapReturn2("MESSAGE")

blnSuccessful = False

Exit Sub

Else

lblJobCount = "OK " & strJobCount

End If

Dim strStepNo As Integer

Dim sapReturn3 As Object

'---define background job ABAP step including variant name

sapJob.AddABAPStep JobName:=txtJobName, Jobcount:=strJobCount, ExternalUserName:=mSAPconn.User, _

AbapProgramName:=Trim(cboProgram.Text), AbapVariantName:=Trim(cboVariant.Text), _

SapUserName:=mSAPconn.User, Language:=mSAPconn.Language, _

StepNumber:=strStepNo, Return:=sapReturn3

'---close background job - scheduled but not released yet

sapJob.Close JobName:=txtJobName, Jobcount:=strJobCount, _

ExternalUserName:=mSAPconn.User, Return:=sapReturn5

'---start background job as soon as possible

sapJob.StartAsSoonAsPossible JobName:=txtJobName, Jobcount:=strJobCount, _

ExternalUserName:=mSAPconn.User, TargetServername:=strTargetServer, _

Return:=sapReturn4

Dim sapReturnX As Object

Dim strStatus As String

'---get the status of the background job

sapJob.GetStatus JobName:=txtJobName, Jobcount:=strJobCount, _

ExternalUserName:=mSAPconn.User, Status:=strStatus, _

Return:=sapReturnX

Former Member
0 Kudos

I am not sure , but try this in a custom RFC function module

Submit RPTQTA00 USING SELECTION-SET and return