Quantcast
Channel: SCN : All Content - All Communities
Viewing all articles
Browse latest Browse all 3363

Why is my job running in background and in foreground simultaneously?

$
0
0

Hello,

My WebDynpro ABAP program calls a remote-enabled function-module, in which I need to save massive amount of records into infotypes' without delaying the user's work flow. So, I implemented the desired code inside a Z program and I call it using SUBMIT...VIA JOB inside my FM. The problem is that it happend twice: the job is indeed being scheduled for execution, while the program runs in the foreground (I can debug it and step into the actual statements) and when it finishes, the job is executed in the background. So the same program runs twice.

 

Why is it happening? Can you tell me how to make the program run only once?

 

Thanks

 

 

      CALL FUNCTION 'JOB_OPEN'

        EXPORTING

          jobname          = lv_job_name

        IMPORTING

          jobcount         = lv_job_number

        EXCEPTIONS

          cant_create_job  = 1

          invalid_job_data = 2

          jobname_missing  = 3

          OTHERS           = 4.

 

 

      IF sy-subrc EQ 0.

        SUBMIT zhr_update_9050 WITH    p_btrtlm EQ lv_btrtl

                                     WITH    p_pernr  EQ space

                                     VIA JOB lv_job_name

                                     NUMBER  lv_job_number

                                     AND RETURN

                                     .

 

 

        IF sy-subrc EQ 0.

          CALL FUNCTION 'JOB_CLOSE'

            EXPORTING

              jobcount             = lv_job_number

              jobname              = lv_job_name

              strtimmed            = abap_true

            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.


Viewing all articles
Browse latest Browse all 3363

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>