Problem solve Get help with specific problems with your technologies, process and projects.

Determining TVARV variables in batch jobs

Have you ever wondered where your TVARV variables are being used in your batch jobs? This tips tells you how to find out!

Have you ever wondered where your TVARV variables are being used in your batch jobs? How do you know if they change,...

and the impact it may have on your interfaces? The program below will provide a listing for you. The program uses Job Count (job id) as the key versus Job Name as job names can be redundant. The code was written in R/3 v.4.6C, but should work in 3.x versions as well.


************************************************************************
* PROGRAM: ZCAUS_EXTRACT_REPORT_VARIABLES
* AUTHOR:  DYLAN HACK
* CREATE DATE: 10/09/2002
* PURPOSE: This program was developed to extract all jobs based on the
*          "Job Status" selection criteria and find the relevant TVARV
*          variable entries. Then the report can be downloaded and
*          sorted on selection variables. Ultimate purpose is to know
*          what jobs are affected by the individual TVARV variables.

*          If a job exists but does not have a corresponding entry/use
*          of a TVARV variable, it will not get listed.
*
*
* JOB STATUS LEGEND:
* R: job step running.
* Y: job step ready (eligible to run, waiting for a work process).
* P: job step scheduled.
* S: job step released (eligible to run when the start condition of the
*    job is fulfilled).
* A: job step aborted.
* F: job step successfully finished.
* Z: system upgrade in progress, only upgrade-related jobs are allowed
*    to run. Jobs and job steps with this status are ignored by the
*    scheduler.
* X: unknown status detected.
************************************************************************

REPORT ZCAUS_EXTRACT_REPORT_VARIABLES .

tables: tbtcp, tbtco.
data: var like RSVARVAR occurs 0 with header line,

      begin of report_tmp occurs 0,
        jobname   like tbtcp-jobname,
        jobcount  like tbtcp-jobcount,
        stepcount type tbtcp-stepcount,
        progname  type syrepid,
        variant   type syslset,
      end of report_tmp,

      report like report_tmp occurs 0 with header line,

      begin of listing occurs 0,
        jobname  type tbtcp-jobname,
        jobcount  like tbtcp-jobcount,
        stepcount type tbtcp-stepcount,
        progname  type syrepid,
        variant   type syslset,
        variable type rsvarvar-variable,
      end of listing.

selection-screen begin of block a1 with frame title text-001.
selection-screen begin of block b1 with frame.
  select-options: s_status for tbtco-status.
selection-screen end of block b1.
selection-screen begin of block b2 with frame.
  selection-screen comment /5(75) com1.
  selection-screen comment /5(75) com2.
  selection-screen comment /5(75) com3.
  selection-screen comment /5(75) com4.
  selection-screen comment /5(75) com5.
  selection-screen comment /5(75) com6.
  selection-screen comment /5(75) com7.
  selection-screen comment /5(75) com8.
selection-screen end of block b2.
selection-screen end of block a1.


initialization.
move:
 'R: Job Running' to com1,
 'Y: Job Ready (Eligible to run, waiting for process)' to com2,
 'P: Job Scheduled' to com3,
 'S: Job Released (Eligible to run when start condition is trigerred)'
to
 com4,
 'A: Job Aborted' to com5,
 'F: Job Successfully Finished' to com6,
 'Z: Upgrade in process, job being ignored' to com7,
 'X: Unknown Status Detected' to com8.




start-of-selection.

* get all jobs in released status
  select jobcount from tbtco into report_tmp-jobcount
    where status in s_status.
    append report_tmp.
  endselect.

* get all related variants for those jobs that meet the where clause.
  loop at report_tmp.
    select jobname jobcount stepcount progname variant
    into  corresponding fields of report
    from tbtcp where jobcount = report_tmp-jobcount and
                     variant not like '&%' and
                     variant <> space.
    append report.
    endselect.
  endloop.

* sort and delete duplicates (if any)
sort report by jobname jobcount stepcount progname variant.
delete adjacent duplicates from report comparing all fields.

* get TVARV selection variables
loop at report.
clear var. refresh var.
  call FUNCTION 'RS_VARIANT_VARIABLES'
    EXPORTING
       PROGRAM = report-progname
       VARIANT = report-variant
    TABLES
     VAR = var
    EXCEPTIONS
        VARINT_NOT_EXISTENT.

* move the data to a listing table
  if var-variable <> space.
   loop at var.
    move: report-jobname   to listing-jobname,
          report-jobcount  to listing-jobcount,
          report-stepcount to listing-stepcount,
          report-progname  to listing-progname,
          report-variant   to listing-variant,
          var-variable     to listing-variable.
    append listing.
   endloop.
  endif.
endloop.

* sort and delete dups from listing
sort listing by jobname jobcount stepcount progname variant variable.
delete adjacent duplicates from listing comparing all fields.
data: count type i. loop at listing. count = count + 1. endloop.

* write out the listing
write: 'Count', count. skip.
write: 2   'Job Name',
       36  'Job #',
       48  'Step',
       54  'Program name',
       95  'Variant',
       110 'Variable'.
loop at listing.
    write: / listing-jobname,
             listing-jobcount,
             listing-stepcount,
             listing-progname,
             listing-variant,
             listing-variable.
endloop.

This was last published in November 2002

Dig Deeper on SAP ABAP

PRO+

Content

Find more PRO+ content and other member only offers, here.

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

-ADS BY GOOGLE

SearchManufacturingERP

SearchOracle

SearchDataManagement

SearchAWS

SearchBusinessAnalytics

SearchCRM

SearchContentManagement

SearchFinancialApplications

Close