Skip to Content
0
Nov 06, 2017 at 11:53 AM

Try run an abap in background fail

122 Views

I have a program which has a checkbox and if the user enable it runs the program in background with the below code:

 data: jobname1 type tbtcjob-jobname,
 jobcount1 type tbtcjob-jobcount.

 jobname1 = 'ZFOR_GET_BKRF_BSEG'.

 call function 'JOB_OPEN'
 exporting
 jobname = jobname1
 importing
 jobcount = jobcount1
 exceptions
 cant_create_job = 1
 invalid_job_data = 2
 jobname_missing = 3
 others = 4.

 if sy-subrc ne 0.
 message s368(00) with 'Error Creating Job'
 sy-subrc.
 exit.
 endif.

 submit zfor_get_bkrf_bseg
 with so_bukrs = so_bukrs
 with so_budat = so_budat
 with p_bckgr = space
 with p_path = p_path
 via job jobname1
 number jobcount1
 and return.

 call function 'JOB_CLOSE'
 exporting
 jobcount = jobcount1
 jobname = jobname1
 strtimmed = 'X' " Start immediately
 exceptions
 invalid_startdate = 1
 jobname_missing = 2
 job_close_failed = 3
 job_nosteps = 4
 job_notex = 5
 lock_failed = 6
 others = 7.

 if sy-subrc > 0.
 message s368(00) with 'Closing Job Failed'
 sy-subrc.
 exit.
 endif.

Unfortunately the background job always canceling with the following error:

Enter date in the format __.__.____ This is the default setup for the user.

Can anyone know what cause the problem and how to fix it?

Thanks in advance Elias