How to run a job in background programatically after 10 sec

Hi Forum,
Can anyone tell me How to run a job in background programatically after 10 sec..
Thanks in advance

Hi,
Here is the example code
*Submit report as job(i.e. in background) 
data: jobname like tbtcjob-jobname value
                             ' TRANSFER TRANSLATION'.
data: jobcount like tbtcjob-jobcount,
      host like msxxlist-host.
data: begin of starttime.
        include structure tbtcstrt.
data: end of starttime.
data: starttimeimmediate like btch0000-char1.
* Job open
  call function 'JOB_OPEN'
       exporting
            delanfrep        = ' '
            jobgroup         = ' '
            jobname          = jobname
            sdlstrtdt        = sy-datum    " You need to give the Date for execution the Job
            sdlstrttm        = sy-uzeit    " You need to give the Time for execution the Job
       importing
            jobcount         = jobcount
       exceptions
            cant_create_job  = 01
            invalid_job_data = 02
            jobname_missing  = 03.
  if sy-subrc ne 0.
                                       "error processing
  endif.
* Insert process into job
SUBMIT zreport and return
                with p_param1 = 'value'
                with p_param2 = 'value'
                user sy-uname
                via job jobname
                number jobcount.
  if sy-subrc > 0.
                                       "error processing
  endif.
* Close job
  starttime-sdlstrtdt = sy-datum + 1.
  starttime-sdlstrttm = '220000'.
  call function 'JOB_CLOSE'
       exporting
            event_id             = starttime-eventid
            event_param          = starttime-eventparm
            event_periodic       = starttime-periodic
            jobcount             = jobcount
            jobname              = jobname
            laststrtdt           = starttime-laststrtdt
            laststrttm           = starttime-laststrttm
            prddays              = 1
            prdhours             = 0
            prdmins              = 0
            prdmonths            = 0
            prdweeks             = 0
            sdlstrtdt            = starttime-sdlstrtdt
            sdlstrttm            = starttime-sdlstrttm
            strtimmed            = starttimeimmediate
            targetsystem         = host
       exceptions
            cant_start_immediate = 01
            invalid_startdate    = 02
            jobname_missing      = 03
            job_close_failed     = 04
            job_nosteps          = 05
            job_notex            = 06
            lock_failed          = 07
            others               = 99.
  if sy-subrc eq 0.
                                       "error processing
  endif.
Regards
Sudheer

Similar Messages

  • How to delete a job in background programatically after 10 sec

    Hi all,
    Can anyone tell me how to delete a job in background programatically after the transaction is trigerred in 10 sec.
    Yours help will be greatly appreciated
    Yathish

    Have a look at standard report RSBTCDEL. May be helpful to you.
    Best Regards,
    Vibha
    *Please mark all the helpful answers

  • Error while running a job in background

    Hi,
      I got the following error message while running the job in background.
    "Step 001 started .
    Control Framework: Fatal error - GUI cannot be reached.
    ABAP/4 processor: RAISE_EXCEPTION
    Job cancelled"
    What is the reason for this error and how to correct it?

    ALV Grid control is based on the custom controls on the screen. When the program is scheduled in background, it tries to create GUI related front-end objects and hence the error u201CFatal Error u2013 GUI cannot be reachedu201D. This type of problem is common with all the programs that use the ALV grid control to display the output.
    Solution:
    Whenever we execute this type of programs in background, we should be passing a blank docking container instead of the custom container as parent to our grid control. 
    The docking container doesnu2019t need any of the custom controls on the screen; instead it attaches an area to any or all of the four edges of the screen (top, left, right or bottom). The behavior of the areas in the container is determined by the sequence in which they are initialized. Docking Containers are attached to the screen from the inside out. This means that when you create a second container, it is attached to the edge of the screen, and the container that was already there is pushed outwards. 
    Let us modify the standard program (by taking a copy of it) to enable it to execute it in background.
    Following modifications have to be made:
    ·        Define a docking container in the program
    data: or_doc  type ref to cl_gui_docking_container .
    ·        At the time of creating a custom container, check if the program is being executed in background or foreground. If the program is scheduled in background, then create a docking container instead of custom container.
    if cl_gui_alv_grid=>offline( ) is initial.
        create object or_custom_container
               exporting container_name = c_container.
      create object or_grid
             exporting i_parent = or_custom_container.
    else .
    create object or_grid
             exporting i_parent = or_doc .
    endif . 
    Now test executing the program in background. The report would be generated.

  • How to run the job using DBMS_SCHEDULER

    How to run the job using DBMS_SCHEDULER
    pleas give some sample Iam very new to DBMS_SCHEDULER

    Hi
    DBMS_SCHEDULER
    In Oracle 10g the DBMS_JOB package is replaced by the DBMS_SCHEDULER package. The DBMS_JOB package is now depricated and in Oracle 10g it's only provided for backward compatibility. From Oracle 10g the DBMS_JOB package should not be used any more, because is could not exist in a future version of Oracle.
    With DBMS_SCHEDULER Oracle procedures and functions can be executed. Also binary and shell-scripts can be scheduled.
    Rights
    If you have DBA rights you can do all the scheduling. For administering job scheduling you need the privileges belonging to the SCHEDULER_ADMIN role. To create and run jobs in your own schedule you need the 'CREATE JOB' privilege.
    With DBMS_JOB you needed to set an initialization parameter to start a job coordinator background process. With Oracle 10g DBMS_SCHEDULER this is not needed any more.
    If you want to user resource plans and/or consumer groups you need to set a system parameter:
    ALTER SYSTEM SET RESOURCE_LIMIT = TRUE;
    Baisc Parts: Job
    A job instructs the scheduler to run a specific program at a specific time on a specific date.
    Programs
    A program contains the code (or reference to the code ) that needs to be run to accomplish a task. It also contains parameters that should be passed to the program at runtime. And it?s an independent object that can referenced by many jobs
    Schedules
    A schedule contains a start date, an optional end date, and repeat interval with these elements; an execution schedule can be calculated.
    Windows
    A window identifies a recurring block of time during which a specific resource plan should be enabled to govern resource allocation for the database.
    Job groups
    A job group is a logical method of classifying jobs with similar characteristics.
    Window groups
    A window groups is a logical method of grouping windows. They simplify the management of windows by allowing the members of the group to be manipulated as one object. Unlike job groups, window groups don?t set default characteristics for windows that belong to the group.
    Using Job Scheduler
    SQL> drop table emp;
    SQL> Create table emp (eno int, esal int);
    SQL > begin
    dbms_scheduler.create_job (
    job_name => 'test_abc',
    job_type => 'PLSQL_BLOCK',
    job_action => 'update emp set esal=esal*10 ;',
    start_date => SYSDATE,
    repeat_interval => 'FREQ=DAILY; INTERVAL=10',
    comments => 'Iam tesing scheduler');
    end;
    PL/SQL procedure successfully completed.
    Verification
    To verify that job was created, the DBA | ALL | USER_SCHEDULER_JOBS view can be queried.
    SQL> select job_name,enabled,run_count from user_scheduler_jobs;
    JOB_NAME ENABL RUN_COUNT
    TEST_abc FALSE 0
    Note :
    As you can see from the results, the job was indeed created, but is not enabled because the ENABLE attribute was not explicitly set in the CREATE_JOB procedure.
    Run your job
    SQL> begin
    2 dbms_scheduler.run_job('TEST_abc',TRUE);
    3* end;
    SQL> /
    PL/SQL procedure successfully completed.
    SQL> select job_name,enabled,run_count from user_scheduler_jobs;
    JOB_NAME ENABL RUN_COUNT
    TEST_ABC FALSE 0
    Copying Jobs
    SQL> begin
    2 dbms_scheduler.copy_job('TEST_ABC','NEW_TEST_ABC');
    3 END;
    4 /
    PL/SQL procedure successfully completed. Hope it will help you upto some level..!!
    Regards
    K

  • Will it be possible to run several jobs in background at the same time?

    Hi!
    The new release looks promising. Look forward to hear more in Birmingham.
    Just now we have a problem. It have to do with functionality In Toad compared to SQL Developer.
    Will it be possible to run several jobs in background at the same time. Toad allows that.
    If yes: How can we make that happen?

    "Jobs" are always background.
    But I take you mean queries. Yes, since v1.5.x you can open an Unshared SQL Worksheet (ctrl-shift-n or the toolbar button).
    Have fun,
    K.

  • How to run form in the background from command line

    please can anybody tell me to
    how to run form in the background from command line
    vishal

    Ummm....Oracle Forms is a foreground runtime kind of thing. What you want is a database procedure (or an OS utility - it depends on what sort of processing you want to do in the background).
    Cheers, APC

  • How to run 3 job(a,b,c) parallel in unix shells script and after will complete d will start  and we have to handle the error also

    how to run 3 job(a,b,c) parallel in unix shells script and after will complete d will start  and we have to handle the error also

    032ee1bf-8007-4d76-930e-f77ec0dc7e54 wrote:
    how to run 3 job(a,b,c) parallel in unix shells script and after will complete d will start  and we have to handle the error also
    Please don't overwhelm us with so many details!  
    Just off the top of my head ... as a general approach ... something like
    nohup proca
    nohup procb
    nohup procc
    while (some condition checking that all three procs are still running ... maybe a ps -ef |grep  )
    do
    sleep 2
    done
    procd
    But, we'd really need to know what it is you are really trying to accomplish, instead of your pre-conceived solution.

  • How to run a job (program in it) every 48 hours

    Dear All,
    Can you please tell me how to run a job every 48 hours. I am not able to find suitable job option.
    Thanks and regards,
    Atanu

    Hi,
    1. Go to SM36 give the job name i.e. ZABC_MYJOB
    2. Click on Steps (Upper left corner - 2nd Button) and assign the ABAP report name .i.e. RSUSR002, Check and Save.
    3. Click on Start Condition (Upper left corner - Ist Button), click Date/Time and specify the Start Date and Time.
    4. Select "Periodic Job" and click on Period values now click on Other Period
    5. Now input 1 in the Minute Box. , and check and save.
    6. Again Check and Save. and Again Check and Save.
    7. Now save the job.
    This job will run after every 1 minut
    (OR) try the below steps.
    you can setup your job in order to start after an event.
    After that you can get the event triggered from the Operating System:
    - log into you Operating System with the SIDadm user id (at the Operating System level) and go to directory /usr/sap/SID/SYS/exe/run
    - Run the SAPEVT executable as follows :
    sapevt YOUR_EVENT -t pf=/usr/sap/SID/SYS/profile/DEV_DVEBMGS00_server001 nr=01
    This will raise the event, and cause the job scheduled within SAP to execute.
    In this way you can use the O.S. (u201Ccrontabu201D for example) functionalities in order to schedule your job between 9am to 6pm.
    Regards
    Shweta

  • How to run a scene in background in javafx

    How to run a scene in background in javafx?

    Can you explain better your objective?
    Because all your scenes vars will be loaded when your app run. The scene is a visual artifact and running it in background could not be usual
    Regards

  • How to run GR55 reports in background for cost center hierarchies

    1.  I have been asked by our users to create batch jobs to run in the background for some GR55 reports, that can then be sent directly to cost center managers via email.
    I have figured out the process to do this as long as the cost center manager only needs to see a single cost center at a time.  However, if they are in charge of multiple cost centers, we also want to send them a summarized report using the hierarchy we have set up.  I can't seem to make this work, as the job only seem to recognize the last cost center in the group and the report is for that cost center.
    Example.  cost centers 100, 200 and 300 belong to hierarchy abc.  If I run the job just for cost center 100 it is fine.  But if I have a variant to run hierarchy abc, or even if I use the range 100 to 300, all I get is a report for cost center 300.
    We cannot use BW because we only have revenue in BW.  I am being asked to make this work from standard R/3 within the GR55 realm of reporting.
    2.  In addition, the report selection criteria includes two separate plan/forecast versions.  They need to update these each month prior to running the reports and sending them out.  I looked at the variables associated with the versions and tried to set them up with default values that I hoped would update automatically so that they don't have to manually change 50 or so variants each month.  But I don't see any dynamic variables that I can use to have the system make that change without going into each variant individually.
    3.  There is another piece to this equation as well.  There is another report they want sent out in batch, but it is several pages wide in SAP and several pages long.  So when you run it in batch and either spool it or get it sent as an email, it is very ugly in the formatting due to all the page splits horizontally and vertically.  If anyone knows how to get the report to stay together like it would if you had excel integration turned on, it would be very helpful.  I have tried running it with that integration turned on, but the jobs are set up with user batch_mgr and not my id, so it isn't working well.  The batch_mgr id is just a system id, not a dialog id.  We also don't want the jobs set up with a regular user id because if people leave, then the jobs all need to be changed.

    Kim,
    I may have options for issues 1 and 2. In case of 3, what I can tell you is I understand the concern, but this is what  typically happens in some standard CO reports that are not ALV compatible, I don't think there is not much  there to do unless you add some custom code for the output.
    In regards to point 1, yes,  I have noticed that this happens in some standard and custom reporting, not sure what is going on. I came up with a work around that  made the trick for my client in a similar scenario; which is editing the cost center groups. For instance, instead  of having the group set as a range from 100 to 300,  the groups are have  listed the cost centers, 100, 200 and 300. Obviously, the disadvantage of  this option is  that it would require a bit of more cost center group maintenance.
    In regards to point 2,  I understand from your note  that your users already have set up selection variants for the report. One option for you is to get the help from a developer to create a custom period variable and tiny program that runs in batch every month that would update that variable accordingly. Once that's done, you may have to update at least once, the selection variant  attributes to change the period to a selection variable, so everytime from that point of time forward that the variable gets updated,  it will be ready with the right value for every selection variant that uses it.
    Hope this helps.
    GG

  • How to run the job under sys id

    Hello ,
    I wanted to run a job under sys id ( Batch user ) , as my authorisation is not sufficiant to run the repoting agent - Precalculation. Where as Batch user have all the roles for the same .
    I am in my login screen , and i wanted to run the job under batch user id ...could you please let me know how can i do it ?
    Regards,
    Manoj

    Hi,
    Try to schedule the job in background and see.
    Thanks,
    JituK

  • How to run a program in background?

    Hi abapers,
    I want to run a program in background using sm36 and sm37.But i am not aware of input in that tansaction.So kindly tell me the steps ho run a program in background.
    Regards
    Ansuman

    Hi Ansuman Parhi,
    by useing T-codes
    First go to transaction SM36 to schedule the job.
    When you enter the "Start condition" for job, do as follow.
    Select processing by "Date/Time".
    Enter date as current date.
    Let us say you are scheduling this job today then give date 08/30/2007.
    Check "periodic job" checkbox.
    Hit "periodic value" button and select to run "Daily"
    Also have a look on below thread
    Re: How to run program in background?
    This is how to do it through code
    data: lv_job_name like tbtco-jobname,
    lv_job_nr like tbtco-jobcount,
    lv_job_released type c,
    lv_job_start_sofort type c,
    lv_print_parameters type pri_params.
    lv_job_name = 'Z_test'. " your background program name
    call function 'JOB_OPEN'
    exporting
    jobname = lv_job_name
    importing
    jobcount = lv_job_nr
    exceptions
    cant_create_job = 1
    invalid_job_data = 2
    jobname_missing = 3
    others = 4.
    if syst-subrc = 0.
    *submit job with all the selection screen params...
    submit (lv_job_name)
    with applfile = applfile
    with p_lines = p_lines
    with rfc_dest = rfcdest
    with p_selmtd = lv_selmtd
    with px_shsim = px_shsim
    with px_sherr = px_sherr
    user syst-uname
    via job lv_job_name number lv_job_nr and return.
    if sy-subrc = 0.
    call function 'JOB_CLOSE'
    exporting
    jobcount = lv_job_nr
    jobname = lv_job_name
    strtimmed = 'X'
    importing
    job_was_released = lv_job_released
    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 syst-subrc 0.
    message i162(00) with
    'An error occured while closing the background job.'.
    stop.
    endif.
    endif.
    endif.
    skip 1.
    write: / 'Background process', lv_job_name ,
    'called successfully' no-gap.
    write: / 'You can check the job in transaction SM37'.
    Hope it will solve your problem..
    Thanks & Regards
    ilesh 24x7

  • How to run a program in background and how to check the output

    I have to run my program as background job... it has a selection screen...... and i need to check the output after its complete.

    hi,
    u need to create one program for this.
    tables:btcevtjob.
    parameters:job(32).
    data:count like btcevtjob-jobcount.
    call the function modules JOB_OPEN,JOB_SUBMIT AND JOB_CLOSE
    and pass the parameters in those function modules.
    once u execute this program,
    go with sm37->provide jobname->select the option scheduled
    ->execute
    selct the entry->go with release option.
    under releasae select immediate option
    save
    select the job name again
    go with release
    status is in finished stage
    now go with spool option
    give spool no
    go for display
    o/p displayed.
    before this,go for se38->provide the name of program which u want to run in back ground->seelct variants->change->provide variant name->go for create->provide input value->go with attributes->provide description->save
    this variant name u have to give in the job_submit fm.
    or
    se38->program->execute->in back ground
    Reward points if useful,
    Thanks,
    Usha

  • HOW TO RUN BODS JOB THROUGH UNIX SCRIPT

    Dear Experts
    Please provide me the way how to call a job by a script .
    I have used Export Execution Command as recommended by below links
    http://scn.sap.com/docs/DOC-34648
    http://scn.sap.com/community/data-services/blog/2012/08/22/sap-bods--running-scheduling-bods-jobs-from-linux-command-line-using-third-party-scheduler
    But I am not able to locate .sh  file in unix server .
    This is required to call a job after completion of parent job.
    Thanks
    Anupam

    You can check the status in "SAP Business Objects Data Services management Console", Below are the steps
    Login in SAP Business Objects Data Services management Console
    Click on Batch Job
    Select the local repository
    Then check your Job Execution status from there
    For your second query there are two ways one is do the same activity what you have done in DEV.
    below are the steps
    Login in SAP Business Objects Data Services management Console and export the Jobs using export execution command from batch job
    SHELL Scripts will be exported in Job Server Log
    Move that SHELL script as per your location
    Update the User environment variable same as DEV only difference is SID is changed
    Thanks,
    Daya

  • Downloading the file in our PC , when running the job in Background

    Hi,
    We have an enquiry for below requirment.
    Our client runs some jobs in front end , but as the time taken to execute the JOB is more than 15 minutes  , he is getting timeout problem, so we want to run the same program in background.
    Generally the output of the report is to download the file into his desktop,  so even when he is running
    the same job in background he want it to be downloaded into his PC, instead of application servor.
      We created a test program similar to the requirment, and ran the job in foreground and the file could easily be downloaded to desktop. Then we ran the program in backgound - The job failed with an error message  Codepage could not be determined  - Message no. FES025.
    My Question is - is it possible to download the file into the desktop while running in background.
    Please help me .
    Thanks in advance.
    Vengal Rao.

    Please search the forum. This question has been asked and answered many times before.
    Rob

Maybe you are looking for

  • Reg:Variant Dependencies & Pricing

    Hi Gurus, I have configured up to the below mentioned steps. 1.Creation of Material Master Record with required settings 2.Creation of Characteristic and it's values 3.Craetion of class 4.Assign characteristics to Class 5.Create configuration profile

  • LOM on Intel Xserve - have newer had use of it!!!

    Hi, A couple of weeks ago I was happy receive my first Xserve. We have amixed Win and Mac environment and I have used Mac OS Server some time to host domain and such. When a new server was needed I went for a Xserve. One important feature was the LOM

  • Will it cost anything to port number from virgin to a vzw family plan?

    I looked and couldn't see this (slightly convoluted) situation covered anywhere. I was wondering if you could help. I use one line of a 5-phone family plan (I'm not the account owner). I have a sister who is interested in taking over the line but wou

  • R.I.P. battery?

    my iBook battery (3 yrs old) has started giving a lot less life than the glory days of yore when I would get a good 4 hours out of it. Now a distant memory. Is there anything I can do to revive it or do I just buy another? Many thanks for any replies

  • Pictures of Mail are not be imported into iPhoto

    Since a couple of weeks it is not possible to export attached photos directly form Mail to iPhoto, as the menu offers this. Is there anywhere a button to click in any settings? Peter