09-15-2008 8:50 AM
Hi Friends,
I need to schedule a report in background at runtime.... for that i got a function Module SUBST_SCHEDULE_GENERATOR
in this function module, we need to pass variant, but as the report is a BDC and should run for different values at every run, values i can get at runtime.Here i need to create a variant for those values ........so that i can pass it to the FM.
Is there any function module or any other way to create a variant at runtime.
or is there any other way to create a background job snd in that case how to pass screen fields..
Thanks & Best regards
Dev
09-15-2008 10:24 AM
Try SUBMIT statement. Check code below.
(Ref: SAP documenation.
Sample:
DATA: number TYPE tbtcjob-jobcount,
name TYPE tbtcjob-jobname VALUE 'JOB_TEST',
print_parameters TYPE pri_params.
...
CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = name
IMPORTING
jobcount = number
EXCEPTIONS
cant_create_job = 1
invalid_job_data = 2
jobname_missing = 3
OTHERS = 4.
IF sy-subrc = 0.
SUBMIT submitable TO SAP-SPOOL
SPOOL PARAMETERS print_parameters
WITHOUT SPOOL DYNPRO
VIA JOB name NUMBER number
AND RETURN.
IF sy-subrc = 0.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = number
jobname = name
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.
IF sy-subrc <> 0.
...
ENDIF.
ENDIF.
ENDIF.
09-15-2008 10:54 AM
Hi , Thanks for replying,
but can you tell me that how i can pass date and time to schedule job using submit......
I am using
1- open_job
2 -submit
3- Close job
its working fine but i am not Getting that how to pass date and time variable?
thanks dev
Edited by: Dev on Sep 15, 2008 3:30 PM