Skip to Content
0

Try run an abap in background fail

Nov 06, 2017 at 11:53 AM

63

avatar image

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

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
Michelle Crapo Nov 06, 2017 at 12:48 PM
4

The problem is with so_budat. If your so_budat is a select option try using "in" instead of "=". See below.

so_budat in so_budat
Show 2 Share
10 |10000 characters needed characters left characters exceeded

I suppose so_budat and so_bukrs are select-options, so use a correct syntax in the submit statement.

In source editor, use of the pattern option, Other pattern, SUBMIT would have provided you a correct code for parameters.


1

Thanks, Michell. You are absolutely right.

0
Luis Sismeiro Nov 06, 2017 at 12:25 PM
0

Hi,

Try to fill the sdlstrtdt and sdlstrttm parameters.

call function 'JOB_OPEN'
    exporting
      delanfrep        = ' '
      jobgroup         = ' '
      jobname          = jobname1
      sdlstrtdt        = sy-datum
      sdlstrttm        = sy-uzeit
    importing
      jobcount         = jobcount1
    exceptions
      cant_create_job  = 01
      invalid_job_data = 02
      jobname_missing  = 03.
  if sy-subrc ne 0.
    "error processing
  endif.
Share
10 |10000 characters needed characters left characters exceeded