Skip to Content
author's profile photo Former Member
Former Member

How to execute the background job?

Hi,

How to execute the background job.My report i have created one job variant(Sm36).

It will exectute the daily at 11p.m.Same way i have schedule the background job.

What is the steps to execute it in my report?Please suggest.

Regards,

Srihitha

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

6 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Nov 21, 2007 at 05:36 AM

    Hi,

    If you want to execute the job in background .There are 2 options.

    1.Online

    Goto se38-->enter program name >(On menu bar) program >

    Exceute-->Background.

    2.Schedule

    Scheduling Background Jobs:

    1. Background jobs are scheduled by Basis administrators using transaction SM36.

    2. To run a report in a background, a job needs to be created with a step using the report name

    and a variant for selection parameters. It is recommended to create a separate variant for each

    scheduled job to produce results for specific dates (e.g. previous month) or organizational units (e.g. company codes).

    3. While defining the step, the spool parameters needs to be specified

    (Step-> Print Specifications->Properties) to secure the output of the report and help authorized users to find the spool request. The following parameters needs to be maintained:

    a. Time of printing: set to “Send to SAP spooler Only for now”

    b. Name – abbreviated name to identify the job output

    c. Title – free form description for the report output

    d. Authorization – a value defined by Security in user profiles to allow those users to access

    this spool request (authorization object S_SPO_ACT, value SPOAUTH). Only users with matching authorization value in their profiles will be able to see the output.

    e. Department – set to appropriate department/functional area name. This field can be used in

    a search later.

    f. Retention period – set to “Do not delete” if the report output needs to be retained for more

    than 8 days. Once the archiving/document repository solution is in place the spool requests could

    be automatically moved to the archive/repository. Storage Mode parameter on the same screen

    could be used to immediately send the output to archive instead of creating a spool request.

    Configuring user access:

    1. To access a report output created by a background job, a user must have at least access to SP01 (Spool requests) transaction without restriction on the user name (however by itself it will not let the user to see all spool requests). To have that access the user must have S_ADMI_FCD authorization object in the profile with SPOR (or SP01) value of S_ADMI_FCD parameter (maintained by Security).

    2. To access a particular job’s output in the spool, the user must have S_SPO_ACT object in the profile with SPOAUTH parameter matching the value used in the Print Specifications of the job (see p. 3.d above).

    3. Levels of access to the spool (display, print once, reprint, download, etc) are controlled by SPOACTION parameter of S_SPO_ACT. The user must have at least BASE access (display).

    On-line reports:

    1. Exactly the same configuration can be maintained for any output produced from R/3. If a user clicks “Parameters” button on a SAP Printer selection dialog, it allows to specify all the parameters as described in p. 3 of “Scheduling background jobs” section. Thus any output created by an online report can be saved and accessed by any user authorized to access that spool request (access restriction provided by the Authorization field of the spool request attributes, see p. 3.d of “Scheduling background jobs” section).

    Access to report’s output:

    1. A user that had proper access (see Configuring user access above) can retrieve a job/report output through transaction SP01.

    2. The selection screen can be configured by clicking “Further selection criteria…” button (e.g. to bring “Spool request name (suffix 2)” field or hide other fields).

    3. The following fields can be used to search for a specific output (Note that Created By must be blank when searching for scheduled job’s outputs)

    a. Spool request name (suffix 2) – corresponds to a spool name in p. 3.b in “Scheduling background jobs” section above).

    b. Date created – to find an output of a job that ran within a certain date range.

    c. Title – corresponds to spool Title in p. 3.c in “Scheduling background jobs” section above).

    d. Department - corresponds to spool Department in p. 3.e in “Scheduling background jobs” section above).

    4. Upon entering selection criteria, the user clicks the Execute button to retrieve the list of matching spool requests.

    5. From the spool list the user can use several function such as view the content of a spool request, print the spool request, view attributed of the spool request, etc. (some functions may need special authorization, see p.3 in Configuring user access)

    a. Click the Print button to print the spool request with the default attributes (usually defined with the job definition). It will print it on a printer that was specified when a job was created.

    b. Click the “Print with changed attributed” button to print the spool request with the different attributes (e.g. changing the printer name).

    c. Click the “Display contents” button to preview the spool request contents. A Print and Download functions are available from the preview mode.

    Afetr scheduling the job , you can check the status iof the job using SM37 Transaction code.

    calling-function-module-starting-new-job

    Following is a sample program:

    DATA: number TYPE tbtcjob-jobcount,

    name TYPE tbtcjob-jobname VALUE 'JOB_TEST',

    print_parameters TYPE pri_params.

    ...

    CALL FUNCTION 'JOB_OPEN'

    EXPORTING

    jobname = name

    IMPORTING

    jobcount = number

    EXCEPTIONS

    cant_create_job = 1

    invalid_job_data = 2

    jobname_missing = 3

    OTHERS = 4.

    IF sy-subrc = 0.

    SUBMIT ZPROGRAM TO SAP-SPOOL

    SPOOL PARAMETERS print_parameters

    WITHOUT SPOOL DYNPRO

    VIA JOB name NUMBER number

    AND RETURN.

    IF sy-subrc = 0.

    CALL FUNCTION 'JOB_CLOSE'

    EXPORTING

    jobcount = number

    jobname = name

    strtimmed = 'X'

    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.

    ENDIF.

    Also refer this blog:

    /people/prashant.patil12/blog/2007/02/20/displaying-alv-grid-in-background-job

    Reward if usefull

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 21, 2007 at 05:31 AM

    Jobs and Job Steps Explained

    Definition

    The work unit of the background processing system is the background job, each of which consists of one or more job steps.

    Jobs and job steps enable you to treat complex tasks as single units. That is, you can schedule several programs needed to complete a particular task as steps within a single job, with the advantage of the job being single logical container for all the steps needed to complete the task. You need to schedule or review only one background job in order to schedule or review any of the individual steps necessary for completing the task.

    Assume that a particular data transfer with batch input requires that you start two programs, an external program to prepare the batch-input session and an internal program to process the session. Creating a job made up of two steps lets you handle the two programs as a single unit. Scheduling that one job schedules both programs. The results of each program's run can be seen in the job log.

    Some background processing attributes apply to entire jobs and, therefore, to all job steps within a job. For example, the earliest possible start time for any job steps will be the start time for the job. Frequency of repetition, priority, and other global attributes also apply to the whole job.

    To ensure that you can flexibly run individual programs, you can set important attributes individually for each job step, too. Each job step can:

    have its own spool, or output, specifications

    run under the authorizations of a separate user

    use a different language

    have its own runtime options (for programs external to the SAP System), such as handling of error output and synchronicity

    In general, job steps run sequentially and synchronously in the order they're entered in a job: the first step starts, runs, and is completed, then the second step starts, and so on. The only exception is when you schedule an external program to run asynchronously. In this case, the background processing system starts the next job step without waiting for a return code from the external program. If the external program runs long enough, then the start of the next job step may overlap it.

    Job steps run partially independently of each other&#30196; status. That is, the abnormal termination of one job step does not roll back the work of a previously completed job step if this previous step was executing a commit. If any job step fails, however, then the entire job fails. No further job steps are carried out, and the job's status changes to Canceled.

    There are two types of job steps:

    An executable ABAP program

    Only type 1, or executable, ABAP programs can be used as job steps. Module pools and function groups, which are collections of ABAP modules, are not allowed. The specifications required for an ABAP job step are:

    ABAP program + Variant + Print and archiving parameters + Language

    An external command or external program

    This type of job step allows you to run programs outside the SAP System. External commands are predefined, authorization-protected commands for end users. External programs are unrestricted, directly entered commands reserved for system administrators.

    The type of external command and external program is unrestricted, meaning that you can use either compiled programs or scripts. Such programs can be run on any computer that can be reached from the SAP System. Parameter passing to non-SAP programs is completely unrestricted except by the predefinition mechanism for external commands.

    Output of non-SAP programs, particularly error messages, is included in the job's log file.

    Specifications required for an external command or program are:

    External command + Type of operating system + (Parameters) + Target host system

    External program + Parameters + Target host system

    Job Step Language

    If your SAP System runs with an Arabic, Cyrillic, or Asian character set, then you may need to change the language specified in the standard background jobs listed above. Languages are assigned to jobs based on job steps. Be sure that the language specified in the job step definition in each of these jobs is set to English (EN).

    This change is required because not all languages are available with all code pages. If the job&#30196; specified language is not available, the job will not run.

    See also:

    External Commands and External Programs

    Job Scheduling Explained

    Managing Jobs from the Job Overview

    http://help.sap.com/saphelp_nw2004s/helpdata/en/c4/3a7f05505211d189550000e829fbbd/content.htm

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 21, 2007 at 05:31 AM

    Hi,

    Use FM,

    JOB_OPEN

    JOB_CLOSE

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 21, 2007 at 05:41 AM
    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 21, 2007 at 06:00 AM

    Thanks for replying.

    Regards,

    Srihitha

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 21, 2007 at 06:44 AM

    Hi Srihita,

    These are the steps to be followed for ur question ( i will send a steps for immdiate output in background, if we want u mention the time in sm37 )

    step 1:

    First create a variant for ur Report and Remember that <b>variant name</b>

    step 2:

    Goto SM36, Give the JOB NAME : ZDEMO

    And JOB CLASS : C

    And click the STEP PUSH BUTTON which is present in application tool bar..

    Then u can give ur report name

    ex: NAME : ZREPORT

    VARIANT : VAR (UR REPORT VARIANT NAME)

    And click save button whick is there in the below.

    And click the START CONDITION push butoon which is present in appliaction toolbar. And click the immediate push button and click save button which is present in below.

    it will take to inital screen and save that screen.Dont forget to save that screen.

    step 3.

    Goto sm37 , Give the

    JOB NAME : ZDEMO

    ABAP PROGRAM NAME : ZREPORT

    And click the EXECUTE button .

    In that screen click the SPOOL push button that will take u to another screen and the TYPE ICON in the output.That display ur OUTPUT.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.