Checking Active Background Job using Function Module

Here’s a piece of code that you can use in your program to check active background job.

  DATA: lt_joblist LIKE tbtcjob OCCURS 0 WITH HEADER LINE,
        ld_line TYPE i.
  
  CALL FUNCTION 'BP_FIND_JOBS_WITH_PROGRAM'
    EXPORTING
      abap_program_name             = sy-repid 
      abap_variant_name             = sy-slset
      dialog                        = 'N'
      status                        = 'R'
    TABLES
      joblist                       = lt_joblist
    EXCEPTIONS
      no_jobs_found                 = 1
      program_specification_missing = 2
      invalid_dialog_type           = 3
      job_find_canceled             = 4
      OTHERS                        = 5.

  IF lt_joblist[] IS NOT INITIAL.
    DESCRIBE TABLE lt_joblist LINES ld_line.
    IF ld_line > 1.
      Message i000(zz) with 'Backgound Job is still active'.
    ENDIF.
  ENDIF.
Advertisements

One comment

  1. I see a lot of interesting articles here, i know writing articles is time consuming, but i know unlimited source of content for your
    blog , just type in google – rewriter creates an unique article in a
    minute

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s