2010 Apr 21 5:35 AM
Hi - ,
Can we call a function in background. If so, what is the syntax for it.
I need to call a function in backgorund with return parameter as timeout variable & do further processing.
Any updates will be highly helpful.
Thanks,
Gyanaraj
Hi,
If your function module is RFC enabled, you can call the function module in background by using IN BACKGROUND TASK as follows:
CALL FUNCTION <function module name> IN BACKGROUND TASK [DESTINATION]
EXPORTING....
EMPORTING....
TABLES.....
EXCEPTIONS....
Regards,
Jayesh
2010 Apr 21 7:15 AM
Hi,
You may create a separate report program and call your function module in that report normally.
Then call this report program in your program by submitting it as a background job.
Regards,
Jayesh
2010 Apr 21 7:23 AM
You may use the following code in your report to submit the new report rpt_call_func(containing the function module)
DATA: global_job LIKE tbtcjob.
DATA: global_start_date LIKE tbtcstrt.
DATA: global_step_tbl LIKE tbtcstep OCCURS 0 WITH HEADER LINE.
DATA: ls_jobs_of_step TYPE ty_bpxminfo.
global_job-jobname = 'MYJOBFOR_CALL_FUNC'.
global_job-jobclass = 'B'.
global_job-newflag = 'O'.
global_step_tbl-program = 'RSBTCPT3'. "dummy step
global_step_tbl-typ = 'A'.
global_step_tbl-status = 'P'. "scheduled
global_step_tbl-authcknam = sy-uname.
APPEND global_step_tbl.
CALL FUNCTION 'BP_JOB_CREATE'
EXPORTING
job_cr_dialog = 'N'
job_cr_head_inp = global_job
IMPORTING
job_cr_head_out = global_job
job_cr_stdt_out = global_start_date
TABLES
job_cr_steplist = global_step_tbl.
SUBMIT rpt_call_func AND RETURN
USER sy-uname
VIA JOB global_job-jobname NUMBER global_job-jobcount
WITH p_func_param1 = gv_var1
WITH p_func_param2 = gv_var2
WITH p_func_param3 = gv_var3
WITH p_func_param4 = gv_var4.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = global_job-jobcount
jobname = global_job-jobname
strtimmed = 'X'
EXCEPTIONS
cant_start_immediate = 1
invalid_startdate = 2
jobname_missing = 3
job_close_failed = 4
job_nosteps = 5
job_notex = 6
lock_failed = 7
OTHERS = 8.
2010 Apr 23 7:12 AM
Hi,
If your function module is RFC enabled, you can call the function module in background by using IN BACKGROUND TASK as follows:
CALL FUNCTION <function module name> IN BACKGROUND TASK [DESTINATION]
EXPORTING....
EMPORTING....
TABLES.....
EXCEPTIONS....
Regards,
Jayesh
| User | Count |
|---|---|
| 6 | |
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |