‎2009 Apr 10 1:46 PM
Hi Experts ,
I have a requirement to call a background Job from RFC Enabled Function Module . As soon as the background job is called , RFC enabled Function Module should exit or complete.
Please advise anyway of achieveing this.
Thanks in advance.
Regards,
Shital.
‎2009 Apr 10 2:20 PM
Just use a [JOB_OPEN, SUBMIT and JOB_CLOSE|http://help.sap.com/erp2005_ehp_04/helpdata/EN/fa/096ee5543b11d1898e0000e8322d00/frameset.htm] in your RFC enabled FM. (Don't forget to provide print parameters if needed if the call comes actually from an external system)
You may also [call your RFC FM in an asynchronous way|http://help.sap.com/erp2005_ehp_04/helpdata/EN/22/042592488911d189490000e829fbbd/frameset.htm] (STARTING NEW TASK)
Regards
‎2009 Apr 13 8:02 AM
Hi ,
Thanks for your reply.It is helpfull.
Could you please comment if Function Module BP_EVENT_RAISE can be helpfull for this requirement?
If yes , please elaborate on this.
Best Regards,
Shital.
‎2009 Apr 10 2:30 PM
when you call a job in RFC, the background job starts and the function module is not in command ..
so you need not worry.
CALL FUNCTION 'JOB_OPEN'
EXPORTING
JOBNAME = JOBNAME
IMPORTING
JOBCOUNT = JOBNUMBER
EXCEPTIONS
CANT_CREATE_JOB = 01
INVALID_JOB_DATA = 02
JOBNAME_MISSING = 03
OTHERS = 99.
IF SY-SUBRC > 0.
<Error processing>
ENDIF.JOB_SUBMIT.JOB_CLOSE.To create variants you can use
RS_VARIANT_LISTRegards,
Lalit Mohan Gupta.
‎2009 Apr 13 8:02 AM
Hi ,
Thanks for your reply.It is helpfull.
Could you please comment if Function Module BP_EVENT_RAISE can be helpfull for this requirement?
If yes , please elaborate on this.
Best Regards,
Shital.
‎2009 Jul 06 7:32 PM
Hello Shital,
Yes, the FM BP_EVENT_RAISE will be helpful in this case:
Here is an example for the FM , Let me know if you have any questions!
Example
Report processing before triggering event...
Trigger event to start background jobs waiting for the event.
DATA: EVENTID LIKE TBTCJOB-EVENTID.
DATA: EVENTPARM LIKE TBTCJOB-EVENTPARM.
EVENTID = 'SP_TEST_EVENT'. " Event name must be defined
" with transaction SM62.
EVENTPARM = 'EVENT1'. " Optional: a job can be
" scheduled to wait for an
" EVENTID or combination of
" EVENTID and EVENTPARM.
CALL FUNCTION 'BP_EVENT_RAISE' " Event is triggered. Jobs
EXPORTING " waiting for event will be
EVENTID = EVENTID " started.
EVENTPARM = EVENTPARM
TARGET_INSTANCE = u2018 u2018 " Instance at which an event
" should be processed. Can
" generally be omitted.
EXCEPTIONS OTHERS = 1. " Exceptions include event not
" defined, no EVENTID
" exported, etc.