Submitting a Zprogram in Background

Hi Masters,
Please help me solving this urgent issue.
Issue Description:
I want to schedule my program in background…means..
My main selection screen is having a single parameter…it appears as..
Last Changed On       ________SY-DATUM_________
Now every night at 12.00 clock night the program should take current date.
And would do the required processing which I have done in my Zprogram....
Here m not getting how to schedule this Zprogram as
in background...
M waiting for positive responses....!!
-=Virendra=-

You can follow one of the following 2 ways:
1)GO to SM36 to schedule your program in background but to make date as current date, do as follows:
Add the following  3 lines of code to your Program:
Let's name the field "Last Changed on" as w_date.
if SY-BATCH = 'X'.
W_date = sy-datum.
endif.
2.
Create a new driver program for your program
and in the driver program , call the following FMs:
  CALL FUNCTION 'JOB_OPEN'
  CALL FUNCTION 'JOB_SUBMIT'
  CALL FUNCTION 'JOB_CLOSE'
To create/ set a dynamic variant for JOB_SUBMIT,
use FM   'RS_CHANGE_CREATED_VARIANT'/'RS_CREATE_VARIANT'
Hope it solves your problem.
Regards
Message was edited by: Akriti
Message was edited by: Akriti

Similar Messages

  • Message capturing while submitting a report in background

    Hi All,
    I am submitting a report in background using job_open and job_close fucntion modules. I want to capture all messages coming while running the report. I am able to capture messages coming in the output but not able to capture the messages coming in the below status bar(error messages). If some error message comes in the selection screen of the submitted report.
    Kindly let me know the way in which i can capture those status error messages.
    Thanks in advance.
    Regards.
    SK
    Edited by: shekhar kumar on Nov 6, 2009 7:07 AM

    hi ,
       write your code in try catch exception  block
    and you can store your exception in and ztable you want .
    at end of report .
    Regards
    Deepak

  • Submitting of smartforms in background

    Hi all,
    Can any one explain me how to submit smartform in background. Explain me in details.
    Thanks In Advance
    Ramana Prasad

    hi
    u can schedule it in backgroud by creating a job in SM36.
    but we need to consider whether this program will be triggered by using OUTPUT TYPE or we can run this using SE38 in foreground.
    if u can run this in forgroung using the print progam then we can run this in backgrounfd also by creating a JOB in SM36.
    i think u r doubt could be... about the dailog which will be displayed before printin.. if it is u doubt---we can avoid this dailog screen by changing the value of output_option.. of the form ... output_options-nodialog = 'X'.
    if have any doubts please let us know
    Please Close this thread.. when u r problem is solved. Reward if Helpful
    Regards
    Naresh Reddy K

  • Problem in Submiting Background Job

    Hi,
    I am submitting a Program in Background  by using JOB_OPEN and SUBMIT Program and JOB_CLOSE.
    After submiting Job was terminated with following log.
    04/07/2009 11:34:05 Job started                                                                                00           516          S
    04/07/2009 11:34:05 Step 001 started (program YSDU_CUSTOMER_DUP_CHECK, variant &0000000000002, user ID JAGASEK)      00           550          S
    04/07/2009 11:34:05 Cannot perform frontend function in batch input mode                                             FES          002          E
    04/07/2009 11:34:05 Job cancelled after system exception ERROR_MESSAGE                                               00           564          A
    Please help me.
    Thanks,
    Sekhar.J

    Hi sekhar J,
    It looks to me like you may be calling a function from SFES (SAP FrontEnd Services) e.g. FM GUI_UPLOAD, these cannot be used in background mode for obvious reasons.  If the program is reading/writing a local file you will need to use a dataset on the application server instead.  If ths is the case there are plenty of posts cocerning datasets on sdn.
    Regards,
    Simon

  • How to get the custom program generated in Background

    Dear Freinds,
    I have written a below code in my submit program ( zreport) .
    REPORT  ZHRRPCPRRU0_SUBMIT  NO STANDARD PAGE HEADING MESSAGE-ID zhr_msg.
    SUBMIT RPTQTA00 VIA SELECTION-SCREEN
    WITH pnpbegda = sy-datum
    WITH pnpendda = lv_date
    with pnppernr = '99007057'.
    As per your logic i have used the submit program and i am able to default the dates  in the Standard program RPTQTA00 , that is perfectly correct . Now if run the standard report it is giivng me the ouput ..so the foreground concept is working correctly.
    Now if iam scheduling the Z report of the custom report (z program) where iam calling the submit program
    it is just scheduling and further when i look at the sm37 i can see the  job getting finished . However , i dont  find any spool because the standard report has not been executed , with my custom report (using the logic with submit program above in zprogram ) i am calling the standard program (RPTQTA00).
    so could you please let me know how the standard program will execute and get the spool genereated? in the case of background
    because when  i have executed only the standard report in background i can see that it is being exceuted spool as well, however when iam calling from custom program no spool is created because my custom program only submiting the standard report and it is not executing the standard report in the case of backround ...because when iam running the custom program in the Foreground it is calling the standard program and getting the values defaulted based on the parameters which i passed , so it gets defaulted later iam running the standard program manually .
    So please could you let me know how will the standard program also gets genereated in the backgroung along with my custom report.
    Thanks in advance
    regards
    madhuri,

    Hi Can you try the following?
    Hope this helps... (Taken from help)
    Example
    Scheduling a submitable program as a background task with the number number in a background request name. After scheduling, the background task is completed by function module JOB_CLOSE and released immediately.
    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 submitable 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.

  • Regarding SUBMIT statement - to process a program in background

    Hi All,
    I have issue of submitting a program in background and also i need to process the no of records come from program by splitting them by 1000(n).
    First of all i have program whose code is like following:
    <b>REPORT  z_update_material_master.</b>
    TYPES: BEGIN OF t_marc,
              matnr LIKE marc-matnr,   "Material Number
              werks LIKE marc-werks,   "Plant
              beskz LIKE marc-beskz,   "Procurement Type
              sobsl LIKE marc-sobsl,   "Special procurement type
              fhori LIKE marc-fhori,   "Scheduling Margin Key for Floats
              dzeit LIKE marc-dzeit,   "In-house production time
              plifz LIKE marc-plifz,   "Planned delivery time in days
              webaz LIKE marc-webaz,   "Goods rcpt processing time
              pwwrk LIKE t460a-wrk02,  "Production plant in planned order
              erhor LIKE t436a-erhor,  "Opening periodr
              zlt   TYPE p DECIMALS 3, "Total replenishment lead time
              ztlt  TYPE p DECIMALS 3, "Total replenishment lead time
              wzeit TYPE p DECIMALS 3, "Total replenishment lead time
              upd(1) TYPE c,            "UPDATE INDICATER
              ind    TYPE c,
         END OF t_marc.
    DATA: i_marc  TYPE SORTED TABLE OF t_marc INITIAL SIZE 0
                   WITH HEADER LINE
                   WITH NON-UNIQUE KEY matnr werks,
          i_marc_rpt LIKE i_marc OCCURS 0 WITH HEADER LINE.
    DATA: l_plantdata  LIKE bapi_marc,
          l_headdata   LIKE bapimathead,
          l_plantdatax LIKE bapi_marcx,
          l_tabix      LIKE sy-tabix.
    CONSTANTS: c_s TYPE c VALUE 'S',
               c_x TYPE c VALUE 'X'.
    DATA i_temp_bapi_return LIKE bapi_matreturn2
                            OCCURS 0 WITH HEADER LINE.
    DATA BEGIN OF i_temp_zppe0091_01 OCCURS 0.
            INCLUDE STRUCTURE zppe0091_01.
    DATA: END OF i_temp_zppe0091_01.
    DATA: l_tab_nam LIKE rstable-tabname VALUE 'ZPPE0091_01'.
    SELECT * FROM zppe0091_01
             INTO CORRESPONDING FIELDS OF TABLE i_temp_zppe0091_01.
    IF sy-subrc EQ 0.
      LOOP AT i_temp_zppe0091_01 WHERE upd = c_x.
        l_tabix = sy-tabix.
        l_headdata-material     = i_temp_zppe0091_01-matnr.
        l_plantdata-plant       = i_temp_zppe0091_01-werks.
        l_plantdata-replentime  = i_temp_zppe0091_01-wzeit.
        l_plantdatax-replentime = c_x.
        CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
          EXPORTING
            headdata       = l_headdata
            plantdata      = l_plantdata
            plantdatax     = l_plantdatax
          TABLES
            returnmessages = i_temp_bapi_return.
        IF NOT i_temp_bapi_return[] IS INITIAL.
          READ TABLE i_temp_bapi_return WITH KEY type = c_s.
          IF sy-subrc EQ 0.
            i_marc_rpt-matnr = i_temp_zppe0091_01-matnr.
            i_marc_rpt-werks = i_temp_zppe0091_01-werks.
            APPEND i_marc_rpt. CLEAR i_marc_rpt.
          ELSE.
            i_temp_zppe0091_01-upd = space.
            MODIFY i_temp_zppe0091_01 INDEX l_tabix TRANSPORTING upd.
          ENDIF.
        ENDIF.
      ENDLOOP.
    ENDIF.
    Now i want to call this program from another program that is already exists by using <b>SUBMIT</b>
    statement in background and i need to process this program by dividing records by <b>1000</b> into seperate session.
    how can i do it. Can any body tell me the solution with syntax.
    I might get lot of records from above program so i want to split them into diffrent sessions based on number of records(1000).
    can any body give me the solution.
    Thanks in advance.
    Thanks & Regards,
    Rayeez.

    Try implementing the following code. Use the code accordingly...
      MOVE 100 TO c_recs_b4_split.
      IF num_src_trans > c_recs_b4_split.
        target_break = num_src_trans / p_thread.
      ELSE.
        target_break = num_src_trans + 1.
      ENDIF.
      wa_subbch  = 1.
      last_index = 1.
    No batch split required if total recrods less than 100
      IF num_src_trans < c_recs_b4_split.
        CLEAR  : range_btch.
        REFRESH: range_btch.
        IF wa_subbch = p_thread.
          target_break = num_src_trans.
        ENDIF.
        MOVE 'S_SRCTRN' TO range_wa-selname.
        MOVE 'S'        TO range_wa-kind   .
        MOVE 'I'        TO range_wa-sign   .
        MOVE 'EQ'       TO range_wa-option .
        LOOP AT itab_src_trans INTO st_src_trans.
          MOVE st_src_trans-src_tran_id TO range_wa-low.
          APPEND range_wa TO range_btch.
        ENDLOOP.
    Step 3 Submit the batch.
        v_job_no = v_job_no + 1.
        PERFORM submit_tp_jobs.
      ELSE.
        DO.
    Step 1 Collect data for the target count
          CLEAR  : range_btch.
          REFRESH: range_btch.
         IF wa_subbch = p_thread.
           target_break = num_src_trans.
         ENDIF.
          MOVE 'S_SRCTRN' TO range_wa-selname.
          MOVE 'S'        TO range_wa-kind   .
          MOVE 'I'        TO range_wa-sign   .
          MOVE 'EQ'       TO range_wa-option .
          IF wa_subbch = p_thread.
            target_break = num_src_trans - v_cnt .
          ENDIF.
          LOOP AT itab_src_trans INTO st_src_trans FROM last_index.
            last_index = sy-tabix.
            batch_total = batch_total + 1.
            IF batch_total <= target_break.
              MOVE st_src_trans-src_tran_id TO range_wa-low.
              APPEND range_wa TO range_btch.
            ELSE.
              EXIT.
            ENDIF.
            v_cnt = v_cnt + 1.
          ENDLOOP.
          CLEAR batch_total.
    Step 2 Submit the batch.
          v_job_no = v_job_no + 1.
          PERFORM submit_tp_jobs.
          ADD 1 TO wa_subbch.
          IF wa_subbch > p_thread.
            EXIT.
          ENDIF.
        ENDDO.
      ENDIF.
    FORM submit_tp_jobs .
      DATA : l_jobcount LIKE tbtcjob-jobcount,
             l_jobrelease LIKE btch0000-char1,
             w_job_flag VALUE 'X',
             w_process_mode,
             w_user_print_params  LIKE pri_params.
      l_jobname = p_batch.
      CONCATENATE 'TP_'  l_jobname '_' v_job_no INTO l_jobname.
      CONDENSE l_jobname NO-GAPS.
      w_process_mode = ' '.
      IF NOT range_btch[] IS INITIAL.
        PERFORM create_post_ctrl.
        CALL FUNCTION 'JOB_OPEN'
          EXPORTING
            jobname  = l_jobname
          IMPORTING
            jobcount = l_jobcount.
        SUBMIT zfi_pc_tran_proc
          AND RETURN
               WITH p_batch  = p_batch
               WITH p_jobid  = p_jobid
               WITH p_mode   = w_process_mode
               WITH p_subbch = wa_subbch
               WITH p_jobq   = p_jobid
               WITH p_cntlmt = p_cntlmt
               WITH p_tpiop  = p_iop
               WITH SELECTION-TABLE range_btch
               USER sy-uname
               VIA JOB l_jobname NUMBER l_jobcount
               TO SAP-SPOOL
               SPOOL PARAMETERS w_user_print_params
               WITHOUT SPOOL DYNPRO.
        CALL FUNCTION 'JOB_CLOSE'
          EXPORTING
            jobcount             = l_jobcount
            jobname              = l_jobname
            strtimmed            = 'X'
          IMPORTING
            job_was_released     = l_jobrelease
          EXCEPTIONS
            cant_start_immediate = 1
            invalid_startdate    = 2
            jobname_missing      = 3
            job_close_failed     = 4
            job_nosteps          = 5
            job_notex            = 6
            lock_failed          = 7
            invalid_target       = 8
            OTHERS               = 9.
      ENDIF.
    ENDFORM.                    " submit_tp_jobs
    Pl. add the points....

  • Using SUBMIT program command in Background

    Hi,
    I am submitting the program in Background using Submit<program> command.
    Job is getting released but not fininishing(not executing the program) in ECC6.0.
    Same program is working in fine in 4.5b.
    Please let me know if any one faces this situation. Its very urgent.
    Expecting the reply from you soon..
    Thanks
    Regards,
    Raj A

    Hi,
    perhaps you or your admin have configured to less batch-workprocess or they are all configured only for A-class jobs.
    Try to start the job as A-Class job. If the program is executed, then ask your administrator to configure more batch workprocess that are not reserved for A-class jobs.
    Regards,
    Stefan

  • Background job Delay In ( sec)

    Hi Experts ,
    I submitted one job in background Via SM37 here i have one question.
    Job is still in Active but it shows  Delay ( sec ) 2,181.
                                                    Duration ( Sec) 1,999
    what it means ?
    Thnx .

    Hi
    refer the below Link:
    http://help.sap.com/saphelp_nw70/helpdata/en/1d/ab3207b610e3408fff44d6b1de15e6/content.htm

  • Out put in Background (SM37) not showing All columns

    Hi Folks,
             I’m creating an out put display for my query in background , we have define an output device , after submitting the query in back ground it just showing me only 10 columns . I mean I its not showing me all columns when I went to SE37-> select job->”spool ->view (display).
    Why it’s happening?
    Please help me
    Cheers
    Usman

    When you are submitting the job in background by exexuting your query from Sq01 or Tr.code , a screen will pop-up ask for you device name, on the same screen you’ll see properties hit that, it’ll take you to another screen and change the report format 65 and 200 or 65 and 200. It depends on your out put device . You can only display report till 255 . If you want to active ALV functional enable in background spool job you have to use extracts for that . So you can download your data in correct format.
    You can also decrease the length of variables in query so within 255 characters you can see all report columns. 
    Hope this’ll help you .
    Hope this’ll give you idea!!
    <b>P.S award the points.</b>
    Good luck
    Thanks
    Saquib Khan
    "Some are wise and some are otherwise"

  • Background processing of Program

    Hi all,
    I have a requirement of background processing of a program which is called from another program.
    Requirement : during execution of Program A, Program B is Submitted to run in background with two field values from Program A.
    Is it possible ? I am able to explore it. Please help.
    Regards,
    Nibha

    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 submitable 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.
    System fields
    sy-subrc Meaning
    0 Background task scheduled successfully.
    4 Scheduling cancelled by user on the selection screen.
    8 Error during scheduling, i.e. when accessing JOB_SUBMIT internally.
    12 Error in internal number assignment.

  • Create spool for background jobs which uses submit statement

    Hi Gurus,
                 I have a quick question regarding the backgroud jobs. When we run a program in the background , it should create a spool for us, but, the problem comes when I am running a program in the background, its not creating the spool. This program uses SUBMIT statement. This program collects the data and it will submit to the other program and then retuen. In this case, its not creating a spool. Its very important for us to look at the spool for this program. Does anybody cam across this kind of problem? I need ur inputs.
    Thanks in advance, <REMOVED BY MODERATOR>
    Regards,
    Srinivas.
    Edited by: Alvaro Tejada Galindo on Mar 18, 2008 4:31 PM

    hi check this link ...
    Scheduling a submitable program as a background task with the number number in a background request name. After scheduling, the background task is completed by function module JOB_CLOSE and released immediately.
    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 submitable 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.
    https://www.sdn.sap.com/irj/sdn/advancedsearch?cat=sdn_all&query=backgroundsubmit&adv=false&sortby=cm_rnd_rankvalue
    sy-subrc  Meaning
    0            Background task scheduled successfully.
    4            Scheduling cancelled by user on the selection screen.
    8            Error during scheduling, i.e. when accessing JOB_SUBMIT internally.
    12          Error in internal number assignment.
    regards,
    venkat.
    Edited by: venkat  appikonda on Mar 18, 2008 6:32 PM

  • Calling FM in background

    Hi All,
    I have a requirement to call one function module in background job. To acheive this, I tried to call this FM in another FM using 'IN BACKGROUND TASK' option. But this option is not scheduling it as a background job, rather its running this FM as a dialog session in background. And it gets terminated after the dialog timeout period.
    The other option is to call this FM in a program and submitting this program in background. But as the input parameter of this FM is complex structure, I am not able to pass this complex table to the pragram.
    Can you please suggest some solution..
    Thanks in advance..
    Archana

    Hi,
    Not sure , but Try using  AS SEPARATE UNIT.
    CALL FUNCTION func IN BACKGROUND TASK
                       [DESTINATION dest]
                        [AS SEPARATE UNIT].
    regards,
    Naveen

  • Execution of report in background and foreground

    Hi all,
    I have a report in which i have two radio buttons on selection screen.
    1, Foreground
    2. background
    could you please tell how to do foreground and background execution of report depends on user selection.if you could send some sample code its really helpful.
    thanks

    If the Background radio button is selected the you need to use the SUBMIT command to submit your program in background.
    Example
    Scheduling a submitable program as a background task with the number number in a background request name. After scheduling, the background task is completed by function module JOB_CLOSE and released immediately providing the user has the relevant authorization.
    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 submitable 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.
    Cheers
    VJ
    Message was edited by:
            Vijayendra  Rao

  • Capturing messages from background session

    Hi,
    I'm running an ABAP report in which I call a function module in several different tasks. This function module is eventually submitting RSNAST00 for generating the outputs. I want to capture the messages for the log like they appear in the job log if RSNAST00 is scheduled in the background job using SM36.
    Since I'm using SUBMIT and RETURN, it runs in a new internal session. Also I do not get back anything in the EXPORTING LIST TO MEMORY.
    Is there any way to capture the system messages that have been generated during that RSNAST00 run.
    Thanks in anticipation,
    Satya

    Ok, I submitted this program in background, it creates 4 more jobs calling my test program ZRICH_0005.  In that program, I am just issuing a message.
    No problems.
    report zrich_0001 .
    data:   l_valid,
            ls_params like pri_params,
            l_jobcount like tbtcjob-jobcount,
            l_jobname  like tbtcjob-jobname.
    parameters: p_check.
    start-of-selection.
      do 4 times.
    * Get Print Parameters
        call function 'GET_PRINT_PARAMETERS'
             exporting
                  no_dialog      = 'X'
             importing
                  valid          = l_valid
                  out_parameters = ls_params.
    * Open Job
        clear l_jobname.
        l_jobname = sy-index.
        shift l_jobname left deleting leading space.
        concatenate 'ZRICH_0005' l_jobname into l_jobname.
        call function 'JOB_OPEN'
             exporting
                  jobname  = l_jobname
             importing
                  jobcount = l_jobcount.
    * Submit report to job
        submit zrich_0005
             via job     l_jobname
                 number  l_jobcount
             to sap-spool without spool dynpro
                 spool parameters ls_params
                             and return.
    * Schedule and close job.
        call function 'JOB_CLOSE'
             exporting
                  jobcount  = l_jobcount
                  jobname   = l_jobname
                  strtimmed = 'X'.
      enddo.
    Regards,
    Rich Heilman

  • Second user's background program in a queue

    Hi SDN
    If a user executes one zprogram in background and in the same time if another user executes this zprogram in the background  then how can we maintain programatically the second user's program in a queue and make it execute after completion of the first one rather than executing simultaneously.
    Thanks in Advance.
    Regards
    Basha

    Hi,
    You can use the below function module:
    open backgroundjob
    ********Declare parameters of function module accordingly
    CALL FUNCTION 'JOB_OPEN'
    EXPORTING
    JOBNAME = JOBNAME
    IMPORTING
    JOBCOUNT = JOBNUMBER
    EXCEPTIONS
    CANT_CREATE_JOB = 01
    INVALID_JOB_DATA = 02
    JOBNAME_MISSING = 03
    OTHERS = 99.
    submit ranges table to program
    SUBMIT REPORTNAME AND RETURN
    with <select-options field of Z_REQUEST_BUSINESS_PARTNER_R3 program> in r_range
    USER SY-UNAME " User for runtime authorizations
    VIA JOB JOBNAME " Job name from job_open function module
    NUMBER JOBNUMBER "job number from job_open
    close the job so that it gets released
    CALL FUNCTION 'JOB_CLOSE'
    EXPORTING
    JOBCOUNT = JOBNUMBER
    JOBNAME = JOBNAME
    strtimmed = 'X' " check this field
    Hope this will help you.
    Please reward if helpful.
    Thank you.

Maybe you are looking for

  • CREATIVE ZEN MICROPHOTO..d

    What the heck. Ive seen this problem everywhere but I protest to bang my zen to make it work. It won't load. It gets stuck at the CREATIVE screen. I downloaded the new firmware, but i can;t get my computer to recognize my computer because the **bleep

  • Date Profile - save date of document's changing

    Hi, I want to define date profle for my document type. Date type should store date of document's last change. Example when user changes doc's status that Date type should store this date. I configured date type in date profile: Determine date only on

  • Stopping tiling in a table background image

    I'm trying to stop the tiling of the background image within a table in Dreamweaver 8. It seems to be different then "no-repeat" for the general background. Was hoping someone could help me out. Thanks.

  • Loading files with my iWeb

    How do I load a file -- say spread sheet, pdf, or word processed document -- with my iWeb? I plan to have a host server different from MMe.

  • Cairo-compmgr + openbox

    I'm trying to get cairo-compmgr working with openbox. I start it in my .config/openbox/autoexec file as cairo-compmgr -n & it really works fine, except that when I close a window the window stays visible (but loses it's decoration) for about 5 to 10