<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic ABAP Background Job Status Report Code. in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-background-job-status-report-code/m-p/3258610#M778427</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My requirement is to Genarate a report that will display the background job Status.&lt;/P&gt;&lt;P&gt;I.e. job cancelled or job abended or job still running like that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My selection screen will be : &lt;/P&gt;&lt;P&gt;     Job Name.&lt;/P&gt;&lt;P&gt;     Run Date .&lt;/P&gt;&lt;P&gt;     Run time .&lt;/P&gt;&lt;P&gt;    Status of Job .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can any one please send me the report code , i searched in google in many ways but i didnt get suitable report for my above requirement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Its very urgent ...Help me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you &amp;amp; Regards,&lt;/P&gt;&lt;P&gt;Vanky.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 03 Jan 2008 10:51:37 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-01-03T10:51:37Z</dc:date>
    <item>
      <title>ABAP Background Job Status Report Code.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-background-job-status-report-code/m-p/3258610#M778427</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My requirement is to Genarate a report that will display the background job Status.&lt;/P&gt;&lt;P&gt;I.e. job cancelled or job abended or job still running like that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My selection screen will be : &lt;/P&gt;&lt;P&gt;     Job Name.&lt;/P&gt;&lt;P&gt;     Run Date .&lt;/P&gt;&lt;P&gt;     Run time .&lt;/P&gt;&lt;P&gt;    Status of Job .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can any one please send me the report code , i searched in google in many ways but i didnt get suitable report for my above requirement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Its very urgent ...Help me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you &amp;amp; Regards,&lt;/P&gt;&lt;P&gt;Vanky.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Jan 2008 10:51:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-background-job-status-report-code/m-p/3258610#M778427</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-03T10:51:37Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP Background Job Status Report Code.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-background-job-status-report-code/m-p/3258611#M778428</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;check tcode sm37..it has almost same functionality as required by u.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;copy its program name from sytem...&amp;gt; status.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;its SAPLBTCH.&lt;/P&gt;&lt;P&gt;in se38, open it and check the dictionary tables used by it..den u can create ur own from dem.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Jan 2008 11:05:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-background-job-status-report-code/m-p/3258611#M778428</guid>
      <dc:creator>former_member188827</dc:creator>
      <dc:date>2008-01-03T11:05:02Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP Background Job Status Report Code.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-background-job-status-report-code/m-p/3258612#M778429</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;data: begin of wa,&lt;/P&gt;&lt;P&gt;  job_name type tbtco-jobname,&lt;/P&gt;&lt;P&gt;run_date type tbtco-strtdate,&lt;/P&gt;&lt;P&gt;run_time type tbtco-strttime,&lt;/P&gt;&lt;P&gt;job_stat type tbtco-status,&lt;/P&gt;&lt;P&gt;  end of wa.&lt;/P&gt;&lt;P&gt;data: itab like table of wa.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select jobname strtdate strttime status from tbtco into table itab where&lt;/P&gt;&lt;P&gt;     status not in ('F', 'P', 'A', 'S').&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab into wa.&lt;/P&gt;&lt;P&gt;  write:/ wa-job_name, wa-run_date, wa-run_time, wa-job_stat.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Jan 2008 11:09:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-background-job-status-report-code/m-p/3258612#M778429</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-03T11:09:57Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP Background Job Status Report Code.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-background-job-status-report-code/m-p/3258613#M778430</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; check BDL_READ_JOB_STATUS  func module&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Jan 2008 11:10:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-background-job-status-report-code/m-p/3258613#M778430</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-03T11:10:15Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP Background Job Status Report Code.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-background-job-status-report-code/m-p/3258614#M778431</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;check SE37 it is same as per your requirement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;Arpit&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Jan 2008 11:29:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-background-job-status-report-code/m-p/3258614#M778431</guid>
      <dc:creator>arpit_shah</dc:creator>
      <dc:date>2008-01-03T11:29:25Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP Background Job Status Report Code.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-background-job-status-report-code/m-p/3258615#M778432</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Venkat,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;here is the code that you can make use of to create a report that list the status of jobs. Here, it is assumed that you have filled the table &lt;EM&gt;&lt;STRONG&gt;gt_jobs&lt;/STRONG&gt;&lt;/EM&gt; with the jobs whoes status you need to check:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
types: begin of gty_jobs,
           JOBCOUNT     type         TBTCO-JOBCOUNT,
           JOBNAME      type	TBTCO-JOBNAME,
           ABORTED	type	TBTCV-ABORT,
           FINISHED	type	TBTCV-FIN,
           PRELIMINARY	type	TBTCV-PRELIM,
           READY	type	TBTCV-READY,
           RUNNING	type	TBTCV-RUN,
           SCHEDULED	type	TBTCV-SCHED,
       end of gty_jobs.

types: gty_t_jobs type table of gty_jobs,

  data: gt_jobs type gty_t_jobs,
        gv_subrc type sysubrc,
        gv_aborted type i,
        gv_finished type i,
        gv_total type i.

  field-symbols: &amp;lt;lfs_jobs&amp;gt; type gty_jobs.

* Get the job status
  loop at gt_jobs assigning &amp;lt;lfs_jobs&amp;gt;.
    CALL FUNCTION 'SHOW_JOBSTATE'
      EXPORTING
        jobcount               = &amp;lt;lfs_jobs&amp;gt;-jobcount
        jobname                = &amp;lt;lfs_jobs&amp;gt;-jobname
       IMPORTING
         ABORTED                = &amp;lt;lfs_jobs&amp;gt;-ABORTED
         FINISHED               = &amp;lt;lfs_jobs&amp;gt;-FINISHED
         PRELIMINARY            = &amp;lt;lfs_jobs&amp;gt;-PRELIMINARY
         READY                  = &amp;lt;lfs_jobs&amp;gt;-READY
         RUNNING                = &amp;lt;lfs_jobs&amp;gt;-RUNNING
         SCHEDULED              = &amp;lt;lfs_jobs&amp;gt;-SCHEDULED
       EXCEPTIONS
         JOBCOUNT_MISSING       = 1
         JOBNAME_MISSING        = 2
         JOB_NOTEX              = 3
         OTHERS                 = 4
              .
  endloop.

* keep on checking the job status until it is finished or cancelled
  while gv_subrc eq 0.

    loop at gt_jobs assigning &amp;lt;lfs_jobs&amp;gt;.
      if &amp;lt;lfs_jobs&amp;gt;-finished ne 'X' and
         &amp;lt;lfs_jobs&amp;gt;-aborted ne 'X'.

**      reduce the frequency of checking the job status to *reduce the network traffic
        wait up to 60 seconds.       

        CALL FUNCTION 'SHOW_JOBSTATE'
          EXPORTING
            jobcount               = &amp;lt;lfs_jobs&amp;gt;-jobcount
            jobname                = &amp;lt;lfs_jobs&amp;gt;-jobname
           IMPORTING
             ABORTED                = &amp;lt;lfs_jobs&amp;gt;-ABORTED
             FINISHED               = &amp;lt;lfs_jobs&amp;gt;-FINISHED
             PRELIMINARY            = &amp;lt;lfs_jobs&amp;gt;-PRELIMINARY
             READY                  = &amp;lt;lfs_jobs&amp;gt;-READY
             RUNNING                = &amp;lt;lfs_jobs&amp;gt;-RUNNING
             SCHEDULED              = &amp;lt;lfs_jobs&amp;gt;-SCHEDULED
           EXCEPTIONS
             JOBCOUNT_MISSING       = 1
             JOBNAME_MISSING        = 2
             JOB_NOTEX              = 3
             OTHERS                 = 4
                  .
        IF sy-subrc &amp;lt;&amp;gt; 0.
           MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                   WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.

        gv_subrc = 0.
        exit.

      else.
        gv_subrc = 4.
      endif.
    endloop.
  endwhile.

* Output job summary
  write: /55  'J O B   S U M M A R Y' color 4.
  write: / sy-uline(150).
  skip 2.
  describe table gt_jobs lines gv_total.


*  loop at gt_jobs assigning &amp;lt;lfs_jobs&amp;gt; where finished ne 'X'.
  loop at gt_jobs assigning &amp;lt;lfs_jobs&amp;gt;.

    if &amp;lt;lfs_jobs&amp;gt;-aborted eq 'X'.
      add 1 to gv_aborted.
      write: / 'Jobname :', &amp;lt;lfs_jobs&amp;gt;-jobname,
            50 'Job ID :', &amp;lt;lfs_jobs&amp;gt;-jobcount color 6.
      write: / sy-uline(150).

    elseif &amp;lt;lfs_jobs&amp;gt;-finished eq 'X'.
      add 1 to gv_finished.
      write: / 'Jobname :', &amp;lt;lfs_jobs&amp;gt;-jobname,
            50 'Job ID :', &amp;lt;lfs_jobs&amp;gt;-jobcount.
      write: / sy-uline(150).
    endif.
  endloop.
      write: / 'Jobs Cancelled :', 15 gv_aborted color 6.
      write: / 'Jobs Finished :', 15 gv_finished.
      write: / 'Total Jobs :', 15 gv_total.


*  clear: gv_aborted, gv_finished, gv_total, gt_jobs.
  clear: gv_aborted, gv_finished, gv_total.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Sanjeev&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Jan 2008 19:27:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-background-job-status-report-code/m-p/3258615#M778432</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-03T19:27:42Z</dc:date>
    </item>
  </channel>
</rss>

