Schedule one program in BACKGROUND

Hi Friends,
I am Developing one FM.There at end of the program i want to submit one program ie
RHINTE30 (Create Batch Input Folder for Infotype 0001).
It should schedule automatically. how can i do this coding.
Please help me.
regards,
Kumar.

Hi,
Check the sample code
Form to open the job with the particular job name
FORM f_open_job USING v_jobname TYPE any.
  CALL FUNCTION 'JOB_OPEN'
    EXPORTING
      jobname  = v_jobname
    IMPORTING
      jobcount = v_jobcount
    EXCEPTIONS
      OTHERS   = 8.
  IF sy-subrc NE 0.
    WRITE: /3 v_werks,
            11 text-008, v_jobname.
  ENDIF.
ENDFORM.                                                    " f_open_job
*&      Form  f_submit_job
Form to submit the program (ZACC0014_COST_COLLECTORS_BDC) as job
FORM f_submit_job.
  v_prog = text-016.
  SUBMIT (v_prog) WITH so_matnr IN r_matnr
                  WITH p_werks EQ v_werks
                  WITH p_date   EQ p_date                 "CCT51576
                  WITH ck_trg   EQ c_trg
                  TO SAP-SPOOL
                  SPOOL PARAMETERS v_params
                  WITHOUT SPOOL DYNPRO
                  USER sy-uname VIA JOB v_jobname NUMBER v_jobcount
                  AND RETURN.
  IF sy-subrc > 4.
    WRITE: /3 v_werks,
            11 text-009, v_jobname.
  ENDIF.
ENDFORM.                    " f_submit_job
*&      Form  f_job_close
Form to close the job
FORM f_job_close.
  CALL FUNCTION 'JOB_CLOSE'
    EXPORTING
      jobcount             = v_jobcount
      jobname              = v_jobname
      strtimmed            = 'X'  "start immediately
    EXCEPTIONS
      cant_start_immediate = 1.
it will help u.

Similar Messages

  • How to schedule BDC program in background when we use GUI_UPLOAD

    Hi,
    I need to run the BDC program in the back ground. But my flat file is in presentation server and i am using GUI_UPLOAD F.M to upload data into I.T. How to schedule BDC program in background.
    Will anybody help me in this regards.
    Thanks in advance,
    Mythily

    You will either have to put your data file on the application server or make the directory of the presentation server available as part of the file system so that the background job will have access to it via OPEN DATASET... TRANSFER... CLOSE DATASET.

  • Write a program that would schedule another program in background multipul

    Hi All,
              I need to write a program that would schedule another program in background multipul times according to input we provided on different application servers.
    For ex:- In  table FKKVKP, i am having 2.1 millons contract accounts. I need to write a program(A) that should take 5000 contract accounts at a time as a input and schedule another program(B) in background with input of 5000 contract accounts. And program A ,again schedule program B on differrent application servers , till 2.1 millions contract accounts get used.
    Thanx in advance.
    Regards,
    Dilip Kushwah

    hi,
    1) Carry out the recording for the required transaction using SHDB.
    2) Use batch input method to create session this is done by three FMs
    bdc: open_group, bdc_insert, close_group.
    3) A session is created , which can be seen in transaction SM 35.
    4) Use the standard program RSBDCSUB to configure the session created in SM35.
    This way you can achieve your requirement.
    Check this links too for more information
    Batch input [http://help.sap.com/saphelp_nw04/helpdata/en/fa/097015543b11d1898e0000e8322d00/frameset.htm]
    [http://help.sap.com/saphelp_nw04/helpdata/en/4c/4c0e8a725311d396a80004ac96334b/frameset.htm]
    [http://help.sap.com/saphelp_nw04/helpdata/en/4c/4c0e8a725311d396a80004ac96334b/content.htm]
    Thanks
    Sharath

  • How to schedule a program in background after 5 or 10 sec

    Hi All,
           Can anyone tell me how to schedule a program after 5 or 10 sec in background after the transaction is completed.
    It is not a custom transaction. I want to execute a Z program in background  in a BADI
    Regards
    Yathish
    Message was edited by:
            Yathish Gundlupet

    Programattically?   You can add this code to the end of your transaction(if it is custom, of course).
    report zrich_0004 .
    data:   sdate type sy-datum,
            stime type sy-uzeit,
            l_valid,
            ls_params like pri_params,
            l_jobcount like tbtcjob-jobcount,
            l_jobname  like tbtcjob-jobname.
    start-of-selection.
    * Get Print Parameters
      call function 'GET_PRINT_PARAMETERS'
           exporting
                no_dialog      = 'X'
           importing
                valid          = l_valid
                out_parameters = ls_params.
    * Open Job
      l_jobname = 'THIS_JOB'.
      call function 'JOB_OPEN'
           exporting
                jobname  = l_jobname
           importing
                jobcount = l_jobcount.
    * Submit report to job
      submit <your_program_name
           via job     l_jobname
               number  l_jobcount
           to sap-spool without spool dynpro
               spool parameters ls_params
                  and return.
    * Kick job off 10 seconds from now.
      sdate = sy-datum.
      stime = sy-uzeit + 10.
    * Schedule and close job.
      call function 'JOB_CLOSE'
           exporting
                jobcount  = l_jobcount
                jobname   = l_jobname
                sdlstrtdt = sdate
                sdlstrttm = stime
    Regards,
    RIch Heilman

  • Schedule Module program in Background with Dynamic Input values ?

    Hi,
    I am trying a schedule a Standard Transaction which has Month,year and other Check boxes (By default they are Empty) .I need to schedule it monthly and Input must change dynamically when I run in background each month..
    How do we do this?
    Regards
    Vara
    Message was edited by: Vara K

    You can not directly schedule a module pool program in background job.  These are usually reports.   What you can do is create a custom report program with your parameters on a selection screen.  In this program you can do a BDC over the standard transaction filling the parameters from the selection screen of the custom program.  This custom program can also have a selection screen variant which uses selection variables that will change dynamically.  Then you can schedule the custom report program via SM36.
    Regards,
    Rich HEilman

  • Scheduling a program in background with after job condition

    Hi experts,
    Is there a way to schedule a background job wherein it will be run every after another job? I've tried defining it on sm36 > start condition> After job> I stated the job name >check start status dependent. But it only run once even if the job which it is dependent on is scheduled everyday.
    Thank you in advance!

    This is (or was)  a well known issue, the option "after job" cannot be set to periodic. Theres lots of threads about this and several alternatives solutions.
    Please search before posting
    Regards
    Juan

  • Scheduling one background job inside another

    Hi All,
    Is it possible to Scheduling one background job inside another.? i.e In my Z program I am calling job_open, job_submit, job_close and to execute one standard report in background. And after that I am executing my Z program itself  from SE38 as Program->Execute->Background->Execute Immediately. Is this logically correct? I am asking this because I am not getting the desired result
    Thanks & Regards,
    Neethu.

    HI,
    Check the job steps in SM36.
    First schedule the Standard job and in the job steps schedule the z report.
    Schedule job in chain

  • Hi any one please explain background job scheduling

    Hi any one please explain background job scheduling . Good answer can be rewarded.
    Thanks

    Background jobs are pgms that are scheduled to be run in the Background without user interaction. So this can be done only for Type 1(executable) Program and not for Module-Pool Programs. Typically, a variant is defined and the pgm is run using the same.
    The transaction code is sm36 -Define Background job. Using the Start Condition tab you can define when you want the job to run (specific time or if it has to follow after a particular job is done etc.,) Using the Step tab you can assign the pgm name and variant.
    After the job is scheduled, you can check the status in sm37, along with the Job log and Spool.
    For more info:
    http://help.sap.com/saphelp_bw30b/helpdata/en/c4/3a7f87505211d189550000e829fbbd/content.htm

  • Schedulling program in Background.

    Hi All,
    I have schedulled a program to be executed in back ground on a date greater than current date. While doing so, i have provided no of pages to be printed wrongly. Now i want to cancel/change only this no.of pages value. So to do this if i reschule this program to be executed in background on the same date & time as set in ealier but with changed/correct value of no.of pages, then will it over write the wrong value and will correctly print on that day? or do i have to do in other way?
    Thanks

    Time/Date/Jobname are not the keys, so you will have two jobs running. You need to delete the wrong one und reschedule it again.

  • Schedule program in background & send output list as group email

    Hello all,
    I have a requirement where I have to schedule a job in background. If there happen to be an output, this output needs to be sent to the email id's stored in a Z Table.
    Please let me know how to proceed.
    Regards,
    Salil

    Hi ,
    yes you can do that..
    see the belwo steps...
    if sy-batch = 'X'.         "this means report is running in Background
    NEW-PAGE PRINT ON NO DIALOG PARAMETERS wa_pri_params.     "creating spool request
      WRITE : / text-s32.
      ULINE.
      LOOP AT t_ouputdata INTO wa_ouputdata.
        WRITE : /  wa_ouputdata.
      ENDLOOP.
      WRITE : / text-s33.
      NEW-PAGE PRINT OFF.                                        "closing spool request
    * To fetch the spool number from TSP01 table
      SELECT rqident
             FROM tsp01
             INTO w_rqident
             UP TO 1 ROWS
             WHERE rq2name = wa_pri_params-plist.
      ENDSELECT.
    * Function Module to Convert Spool to PDF file
      CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
        EXPORTING
          src_spoolid     = w_rqident
          no_dialog       = 'X'
          dst_device      = 'LP01'
          pdf_destination = 'X'
        TABLES
          pdf             = t_pdf.
    "Call function and send the t_pdf data which contains output to email...
    "SO_NEW_DOCUMENT_SEND_API1 - Sending express mail ( SAP office )
    "RS_SEND_MAIL_FOR_SPOOLLIST - Send message from ABAP/4 program to SAPoffice.
    "SO_NEW_DOCUMENT_ATT_SEND_API1 - SAPoffice: Send new document with attachments via RFC
    ELSE.
    "call alv or normal display if you run report foreground..
    endif.
    Regards,
    Prabhudas

  • How can i schedule concurrent program for every one hour from back end

    Hi ,
    I want to schedule concurrent program for every one hour from back end .
    Example
    1) xyz is the concurrent program that should run for every one hour with a parameter 111 and the SAME concurrent program that
    should run every 2 hours with a different parameter like 222.
    I mean Conc prog should run for different parametrs with a different scheduling..
    Please guide me to solve the issue.
    Thanks in advance...
    Regards
    Narender B

    Hi ,
    I have used following code for scheduling the concurrent program from backend.
    declare
    l_request_id NUMBER;
    l_return_code boolean := FALSE;
    BEGIN
    fnd_global.apps_initialize(62991,54477,20003);
    l_return_code := FND_REQUEST.SET_OPTIONS ('YES');
    l_return_code :=fnd_request.set_repeat_options('16:36:00','','DAYS','START','','Y');
    l_request_id:=fnd_request.submit_request(application => 'xbol',
    program => 'NAPP_START_GENERATE_CHART_DATA',
    description => 'Processing chart ',
    start_time => SYSDATE,
    sub_request => FALSE,
    argument1 =>4000130957231588,
    argument2 => null
    COMMIT;
    dbms_output.put_line('Program has been submited and request id is '||l_request_id);
    END;
    Here the issue was concurrent program is completing with a warning like
    Resubmission of request 75588551 has been cancelled.
    FND_RESUB_PRIVATE.PROCESS_INCREMENT EXCEPTION: ORA-01403: no data found
    Resubmission of request 75588551 has been cancelled.
    FND_RESUB_PRIVATE.PROCESS_INCREMENT EXCEPTION: ORA-01403: no data found
    so i could not find the solution for this issue,please anybody guide me to solve this issue.
    Regards
    Narender B

  • Scheduling program in background

    Hi All
       I have scheduled a program with selection screen in background.
       I have scheduled it to run every minute . when I go to sm37 and check it shows the job my job name and against it it say 'Released' .
      Why doesn't my program start in background.
    Kindly help me resolve this issue.

    Hi
    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'.
    Use Sm36 and SM37 Transaction
    http://help.sap.com/saphelp_nw04s/helpdata/en/73/69ef5755bb11d189680000e829fbbd/frameset.htm
    <b>Reward if usefull</b>

  • Execute program in background(Scheduled)

    Hi guyz
    I want to execute a program on every last friday of the month. It should be scheduled automatically in back ground with out any manual interruption. Is there any way i can do that?
    Thanks

    Hi Satya,
    For executing jobs in non-interactive mode, schedule the job for background processing. To create a background processing job you should specify:
      The name of the report
      The name of any variant it needs
      What to do with output
      When to start it
    After this, the SAP system does not require user’s intervention and can proceed with the job even without you. It executes the report and prints the output using printer or output controller. While scheduling a job in background process, three parameters should be specified. These parameters are:
      Definition of programs
      Its start time
      The printing specification for getting the prints as required
    After this, you can check whether your job was executed successfully and display a log of any system messages.
    For scheduling background processing, you have to direct the system to process an ABAP/4 or external program in the background. This is a two-step process:
       Scheduling the program
       Releasing the job
    This needs to have a special authorization for releasing and scheduling the job. Generally, the system administrator, who organizes and monitors background processing, supervises the release of these jobs. Many users are also authorized to schedule background processing of reports. You cannot schedule a job unless and until you have a release authorization. If a user is authorized and has specified a start date or selected "start immediately," he or she can release the job.
    Authorized users can change start time. A program can be scheduled as a separate job or you can append it to an existing job, which has not yet been processed. Background process can be run while doing some other online work. However, this can adversely affect online operation and should be avoided. For example, if you run a program that locks the database, the work of online users will be hampered or stopped. Often, long-running reports are scheduled automatically or semi-automatically for background processing.
    First Step
    Initiate the job scheduling function. Standard job scheduling must be used in case of scheduling of an external command or external program as a background job and ABAP job scheduling function can be used to schedule ABAP programs. For starting a standard job scheduling function choose the following:
    Administration menu bar option à CCMS option à Jobs option à Definition option.
    For starting ABAP job scheduling function, navigate to ABAP Editor and choose Program menu bar option àExecute option à Background option.
    Second Step
    Now define a job. Using the Job Wizard you can define your job. From the Application toolbar, choose the wizard button. After this, the initial screen of the SAP Job Wizard appears. The Job Wizard is available only from the standard job scheduling function.
    Third Step
    Now, you have to save the job. When it displays the message "Job saved" it means the job has been successfully scheduled. We know that a job must be released before it is scheduled. Only authorized users can release the job, otherwise your system administrator will release your job.
    Fourth Step
    This is the last step of scheduling. In this step you have to check the status of your job. For this you need to choose System menu bar option à Own jobs option.
    In SAP System, the background processing runs according to your instructions. In case a list is generated by the report, the report either prints directly or waits for you in the SAP output controller. The status of background processing can be checked for its correctness.
    I think this will help you.
    If so then award the points.
    Thanks and regards
    Vipin Das V

  • How to submit a Program in Background without wait ?

    hi experts,
        I have one requirement in which i want to call another executable program from one program by passing some parameters to the calling program from called program. <b>I dont want to wait till the executatio of the calling program gets over.</b>i just want to submit the program & <b>wants to continue with my calling program</b>.
    i am not bothered with the results of the called program.
         How to do this...
    if possible pl. send me the code. especially i am using some parameters & internal tables to be passed to the called program from calling program.
    Regards,
    Umesh

    Hi Umesh,
    You can schedule a job programatically .. Please find below the steps..
    This will schedule a background job (and this you can view in Sm37) and returns control to the calling program.
      DATA: jobnumber TYPE tbtcjob-jobcount,
                jobname   TYPE tbtcjob-jobname.
    Set the job name
    jobname = 'xxx'.
      CALL FUNCTION 'JOB_OPEN'
           EXPORTING
                jobname  = jobname
           IMPORTING
                jobcount = jobnumber
           EXCEPTIONS
                OTHERS   = 0.
      SUBMIT reportname USER sy-uname
                                    VIA JOB jobname
                                   NUMBER jobnumber
                                   WITH  param1 =   "fill the parms/sel fields with new values
                                   WITH  Param2=     "fill the parameters/sel fields
         AND RETURN.
       CALL FUNCTION 'JOB_CLOSE'
           EXPORTING
                jobcount  = jobnumber
                jobname   =jobname
                strtimmed = 'X'
           EXCEPTIONS
               OTHERS    = 0.
    Thank You.
    Regards,
    Uma

  • Call external program in background mode

    Hi,
    I am creating a PO using bapi BAPI_PO_CREATE1 in exit USEREXIT_SAVE_DOCUMENT_PREPARE.
    I dont want to write the code in my exit. Instead I want to write the code in a Z program and call it in my exit.
    My Problem.
    How do I call my z program in my exit so that I can pass internal tables from my exit to the z program. Also I want to schedule the call of my external program for background processing.
    I am trying with SUBMIT ZPROG AND RETURN. But not able to pass an internal table.
    I tried PERFORM BAPI_PO_CREATE IN PRGRAM ZPROG, but in this case not able to schedule it in background.
    Please advise.
    Regards,
    Shobhit

    Hi Rich,
    Im setting runtime error:
    My Code in Exit: (xvbfa is the table which i wanna pass)
    concatenate 'SERVICEPO' sy-datum into l_key.
    export xvbfa = xvbfa
                  to shared buffer indx(st) id l_key.
    My Code in the called program ZMM_SERVICE_PO
    Runtime Errors         CONNE_IMPORT_WRONG_OBJECT_TYPE
    Exceptn                CX_SY_IMPORT_MISMATCH_ERROR
    Date and Time          05.12.2005 21:41:54
    ShrtText
         Error when attempting to IMPORT object "XVBFA".
    What happened?
         Error in ABAP application program.
         The current ABAP program "ZMM_SERVICE_PO" had to be terminated because one of
          the
         statements could not be executed.
         This is probably due to an error in the ABAP program.
         When importing the object "XVBFA", the object in the
         dataset had a different type from the target object in the program
         "ZMM_SERVICE_PO" (object types: field, field string/structure, table).
         table).
    Error analysis
         An exception occurred. This exception will be dealt with in more detail
         below. The exception, assigned to the class 'CX_SY_IMPORT_MISMATCH_ERROR', was
          not caught, which
          led to a runtime error. The reason for this exception is:
         The object "XVBFA" has a different object type in the dataset from
         that in the target program "ZMM_SERVICE_PO". (Object types: Field, flat
          structure,
         deep structure, flat table, deep table).
    Missing Handling of System Exception
        Program                                 ZMM_SERVICE_PO
    Trigger Location of Exception
        Program                                 ZMM_SERVICE_PO
        Include                                 ZMM_SERVICE_PO
        Row                                     43
        Module Name                             START-OF-SELECTION
    Source Code Extract
    Line  SourceCde
    REPORT  ZMM_SERVICE_PO.
    DATA: l_poheader      LIKE bapimepoheader.
    DATA: l_poheaderx     LIKE bapimepoheaderx.
    DATA: l_poitem        LIKE bapimepoitem     OCCURS 0 WITH HEADER LINE.
    DATA: l_poitemx       LIKE bapimepoitemx    OCCURS 0 WITH HEADER LINE.
    DATA: l_cond          LIKE BAPIMEPOCOND     OCCURS 0 WITH HEADER LINE.
    DATA: l_condx         LIKE BAPIMEPOCONDX    OCCURS 0 WITH HEADER LINE.
    DATA: l_poschedule    LIKE bapimeposchedule OCCURS 0 WITH HEADER LINE.
    DATA: l_poschedulex   LIKE bapimeposchedulx OCCURS 0 WITH HEADER LINE.
    DATA: l_purchaseorder LIKE bapimepoheader-po_number.
    DATA: l_return        TYPE BAPIRET2 OCCURS 0.
    DATA: l_error_found   TYPE c.
    DATA: l_show_messages TYPE c.
    DATA: l_eindt(10)     TYPE c.
    DATA: l_answer        TYPE c.
    DATA: l_VBAK          TYPE STANDARD TABLE OF VBAK WITH HEADER LINE.
    DATA: l_VBFA          TYPE STANDARD TABLE OF VBFA WITH HEADER LINE.
    DATA: xlips           TYPE STANDARD TABLE OF LIPS WITH HEADER LINE.
    *DATA: xvbfa           TYPE STANDARD TABLE OF vbfa WITH HEADER LINE.
    DATA xvbfa like vbfa.
    DATA: l_key(60) type c.
          concatenate 'SERVICEPO' sy-datum into l_key.
    >>>>> import xvbfa = xvbfa
                      from shared buffer indx(st) id l_key.
          delete from shared buffer indx(st) id l_key.
    Could you help.
    Regads,
    Shobhit

Maybe you are looking for