Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Try run an abap in background fail

ekekakos
Participant
0 Kudos

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

1 ACCEPTED SOLUTION

mmcisme1
Active Contributor

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
4 REPLIES 4

luis_sismeiro
Participant

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.

mmcisme1
Active Contributor

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

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.


0 Kudos

Thanks, Michell. You are absolutely right.