on 04-21-2008 1:57 PM
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am not sure , but try this in a custom RFC function module
Submit RPTQTA00 USING SELECTION-SET and return
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
108 | |
12 | |
11 | |
6 | |
5 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.