JOB_OPEN and JOB_SUBMIT

could anybody tell me how to writ the code for scheduling the background job by using function modules JOB_OPEN and JOB_SUBMIT in my report program.
this is not BDC program..it is just a normal report.
Cheers & Thanks

Use JOB_OPEN to indicate you want to create a background job. Use
JOB_INSERT to define the steps in your background job and JOB_CLOSE to
indicate that you have completed your definition of it.
The parameters of these functions mimic the input requirements from
SE37. If you look at their definition in SE11 the vast majority of these
parameters are self-explanatory.
Kind Regards
Chaitanya

Similar Messages

  • How we will use these Job_open and Job_submit job_close??

    Hi Experts,
    i am new in Developement, i need one help here my problem is
    I have one issue which is a report here i am getting the data into internal table, that data fetching i want to schedule it in background job..
    can any body tell me how can i use the JOB_OPEN and JOB_SUBMIT function modules....
    plz provide any example..
    Thanks in Advance,
    Venkat N

    Hi,
    Here is the sample program
    *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
                sdlstrttm        = sy-uzeit
           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

  • How can I erase a job in SM35 using the job_open and job_close functions?

    Hi!
    I call and execute a job in the SM35 transaction with the functions below, but how can I erase the job from SM35. Because when the functions are executed in the JOB_CLOSE the variable jobrele return me an 'X' that means that the job is executed but I see that the job is not erased from the transaction.
    Thanks for the help.
      CALL FUNCTION 'JOB_OPEN'
        EXPORTING
          jobgroup         = bi
          jobname          = jname
        IMPORTING
          jobcount         = jnumb
        EXCEPTIONS
          cant_create_job  = 1
          invalid_job_data = 2
          jobname_missing  = 3
          OTHERS           = 99.
    CALL FUNCTION 'JOB_SUBMIT'
      EXPORTING
        authcknam                         = sy-uname
        jobcount                          = jnumb
        jobname                           = jname
        REPORT                            = sy-repid
    IMPORTING
       STEP_NUMBER                        = v_step_number.
    EXCEPTIONS
       BAD_PRIPARAMS                     = 1
       BAD_XPGFLAGS                      = 2
       INVALID_JOBDATA                   = 3
       JOBNAME_MISSING                   = 4
       JOB_NOTEX                         = 5
       JOB_SUBMIT_FAILED                 = 6
       LOCK_FAILED                       = 7
       PROGRAM_MISSING                   = 8
       PROG_ABAP_AND_EXTPG_SET           = 9
       OTHERS                            = 10
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
      CALL FUNCTION 'JOB_CLOSE'
        EXPORTING
          jobcount                   = jnumb
          jobname                    = jname
          strtimmed                  = 'X'
          targetsystem               = batchsys
        IMPORTING
          job_was_released           = jobrele
        EXCEPTIONS
          cant_start_immediate       = 1
          invalid_startdate          = 2
          jobname_missing            = 3
          job_close_failed           = 4
          job_nosteps                = 5
          job_notex                  = 6
          no_release_privilege_given = 7
          OTHERS                     = 99.

    hi
    try this FM
    <b>BP_JOB_DELETE</b>
    the same  FM is also called in
    <b>
    SCMA_DELETE_JOB</b>
    plz reward if useful

  • How do JOB_OPEN, JOB_SUBMIT, & JOB_INSERT Work?

    Hi,
    Can anybody tell me how to use the function modules JOB_OPEN and JOB_SUBMIT in my report program?
    Thanks,
    Das.

    Hi Manosh,
    see the sample code for the Job scheduling using the fun modules
    IF p_bjob = 'X'.
    CONCATENATE sy-cprog sy-datum sy-uzeit
    INTO jobname SEPARATED BY '_'.
    CALL FUNCTION 'JOB_OPEN'
    EXPORTING
    jobname = jobname
    IMPORTING
    jobcount = jobcount
    EXCEPTIONS
    cant_create_job = 1
    invalid_job_data = 2
    jobname_missing = 3
    OTHERS = 4.
    CALL FUNCTION 'GET_PRINT_PARAMETERS'
    IMPORTING
    out_archive_parameters = arc_params
    out_parameters = print_params
    valid = valid
    EXCEPTIONS
    archive_info_not_found = 1
    invalid_print_params = 2
    invalid_archive_params = 3
    OTHERS = 4.
    IF valid = chk.
    SUBMIT yREP WITH s_kunnr IN s_cust
    AND RETURN
    USER sy-uname
    VIA JOB jobname
    NUMBER jobcount
    TO SAP-SPOOL
    SPOOL PARAMETERS print_params
    ARCHIVE PARAMETERS arc_params
    WITHOUT SPOOL DYNPRO.
    CALL FUNCTION 'JOB_CLOSE'
    EXPORTING
    jobcount = jobcount
    jobname = jobname
    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
    invalid_target = 8
    OTHERS = 9.
    IF sy-subrc 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ELSE.
    MESSAGE i029 WITH jobname.
    ENDIF.
    ELSE.
    MESSAGE s000 WITH text-003.
    STOP.
    ENDIF.
    ENDIF.
    Also,
    Yes you can use job functions:
    JOB_OPEN
    JOB_SUBMIT
    JOB_CLOSE
    You can add multiple steps into one job by using JOB_SUBMIT.
    kindly reward if found helpful.
    cheers,
    Hema.

  • Running a ALV Report in bakcground and sending it to Email/FAX

    Hi,
         I am designing a ALV report to send a email/fax/Printer which has to be run in background or foreground according to selection screen inputs.
    I am doing the following
    1. After generating ALV report, converting it to pdf
    2. Sending Email or Fax or Print from selection screen value.
    3. after that scheduling in background using JOB_OPEN and JOB_SUBMIT FM's.
    Can I use SO_DOCUMENT_SEND_API1 FM for both Email and Fax.
    When I schedule the report in the background using JOB_OPEN, at which point I have to code it inside the report. Is it after I generate the ALV Report and Email sending code or before it..
    Thanks

    Hi
    How did you end up doing the emailing? I have the same task.....

  • A question about Job Creation

    Hi Expert,
    By JOB_OPEN, JOB_SUBMIT, JOB_CLOSE, we can schedule a job.
    When the first two FMs is executed, the job is still in 'scheduled' status. Only when the FM JOB_CLOSE is executed, the job will be in 'released' status.
    In my applicaiton, I need to check the job status. If the job is in 'scheduled' status, I think that the job creation is not successsful; Otherwise, the job creation is successful.
    But the issue is, if job is in 'scheduled' status, how can I know whether all three FMs is executed in the job creation or only JOB_OPEN and JOB_SUBMIT are executed while JOB_CLOSE still not starts?
    In the later case, the applicaiton should wait some time and check the job later.
    Thanks for your support
    Best Regards, Johnney.

    Hi,
    Suppose there two APIs.
    In API1, there are four steps:
    1. call FM JOB_OPEN
    2. call FM JOB_SUBMIT
    3. Save the Jobname and Jobcount in the DB
    4. CAll JOB_CLOSE
    in  API2, there are two steps:
    1. get the Jobname and Jobcount from the DB
    2. Call FM BP_JOBLIST_STATUS_GET to get the job status.
    API1 and API2 are executed asynchronically. Consider the following case:
    After STEP3 is executed(STEP4 has not yet been started), the API2 starts to run. Now the job status that API2 get is 'Scheduled'.
    This is not correct, because the job creation is still not finished. The API2 should wait some time and check later.
    So my question, is how API2 know that the job creation is not finished.
    Thanks & Best Regards, Johnney.

  • Back ground job needed to scheduled immedietly using ABAP coding

    is there anything in ABAP coding in JOB_OPEN and JOB_SUBMIT, i can trigger immedtiely ,i need not to goto SM#& and do manualy
    please help me in this
    thanking you 'sridhar

    Hi,
    I use parameter STRTIMMED  with function module JOB_CLOSE.
      CALL FUNCTION 'JOB_OPEN'
        EXPORTING
          jobname          = local_job-jobname
        IMPORTING
          jobcount         = local_job-jobcount
        EXCEPTIONS
          cant_create_job  = 1
          invalid_job_data = 2
          jobname_missing  = 3
          OTHERS           = 4.
    SUBMIT abap
              WITH param = p_param AND RETURN TO SAP-SPOOL
                    VIA JOB local_job-jobname NUMBER local_job-jobcount
                  WITHOUT SPOOL DYNPRO
                  DESTINATION 'ZMD'
                  IMMEDIATELY ' '
                  KEEP IN SPOOL 'X'.
        CALL FUNCTION 'JOB_CLOSE'
          EXPORTING
            jobcount             = local_job-jobcount
            jobname              = local_job-jobname
            strtimmed            = 'X'
            targetserver         = w_sys
    Cheers
    Allan

  • Job_Open FM

    Hi,
       In my pgm i have made use of Job_open and Job_close.When i click a button a background job will be scheduled for this have used the open FM.My issue is i have to display a message once the background job is scheduled.After passing through the FM job_open it doesnt see the job has scheduled.In which part this background job starts.Plz help

    Hi,
    Call the FM in the below order: in your report...(you need not explicity submit the job the below FM takes care)
    JOB_OPEN
    JOB_SUBMIT --- This will schedule the background job..Hence you can give the message here...
    JOB_CLOSE
    Regards
    Shiva

  • How to get the job logs from sm35 by using the queue id and session name?

    hi all,
    can any one please let me know how to read the job log from sm35 by using the session name and queue id. i have the job name and job count but is it possible to download the job log by using the queue id and session name.
    FYI..
    i want to read this job log and i want to send it to an email id.
    -> i am using the job_open and submitting the zreport via job name and job count and then i am using the function module  job_close.
    but this is not working in my scenario i have the queue id and session name by using this two i want to get the job log is there any function module available or code please provide me some inputs.
    thanks in advance,
    koushik

    Hi Bharath,
    If you want to download it to the local file then you can follow the instructions in the below link.
    How to download Batch Input Session Log?
    Regards,
    Sachin

  • Force Background processing with SUBMIT and keeping results in memory

    Hi Everyone
    I have a very tricky issue that i need some help with.
    I have a developed an RFC that allows a NON-SAP front-end to execute reports in the SAP backend the result of the report is saved in memory and formatted to XML and passed to the front-end where the report is displayed.
    Therefore for this to work i have added the following code
    g_guid = cl_salv_export_db_storage=>create_guid( ).
      " Set ALV memory parameters
    export l_mode = 'M' to memory id 'ALV_EXTRACT_MODE'.
      export l_guid = g_guid to memory id 'ALV_EXTRACT_GUID'.
      "Execute the selected report
      SUBMIT (wlv_report_name)
                         USING SELECTION-SET wlv_variant_name
                         WITH PNPTIMED EQ ' '
                         WITH PNPBEGDA EQ im_begda
                         WITH PNPENDDA EQ im_endda
                         WITH PNPPERNR IN wlr_employee
                         AND RETURN.
    data: l_xstring type xstring.
                l_xstring = cl_salv_export_db_storage=>import_xmlstring(
                    guid  = g_guid ).
    This allows me to get the report results to be passed to the front-end.
    This works quite good for most reports but in some cases the reports has a popup message. In this case the execution fails as the report is not executed as a background job (if the report is executed in the background then the popups are ignored).
    The issue is that the reports cannot be executed in the background as the memory will then not contain the report results and secondly the client does not want to use the spool for the report results at all. The second constraint is that the client does not want to alter the reports in any form to remove the popups due to the large volumes of reports.
    What i have noted is that if the report is executed and i set the SY-BATCH parameter to "X" then it works perfectly (via the debugger). I can change the SY-BATCH value in my code but obviously once the SUBMIT is executed the SY parameters are reset.
    My question is: Is there a way to force the SY parameter values when i perform a SUBMIT? Or is there any other possible solution to this issue?

    If you want to go with the option of spool, then you can use the following addition
    SUBMIT <reportname> to SAP-SPOOL
      SPOOL PARAMETERS <print_parameters>
      WITHOUT SPOOL DYNPRO and RETURN.
    and then read the spool,
    if you want to go with the option of a background job, then you can use the following addition
    SUBMIT <reportname> VIA JOB <name> NUMBER <num> AND RETURN.
    <name> and <num> are generated using FM JOB_OPEN, and then you have to close it using JOB_CLOSE.
    Thanks.

  • Combining two or more adobe form PDF output and mailing the same.

    Hi Guru's,
    I am executing a range of documents and I have to mail the documents. For examole 1 to 10 docs. I need to send it as PDF attachment. In that all the documents 1 to 10 should be combined to one PDF and it should be mailed with PDF attachment. Can anybody please help me get it done.
    I am using GETPDF parameter in JOB_OPEN and fillable = 'x' in FM. I can do with one document, I need how to attch several documents and send it as mial.
    Expection your reply's.
    Regards
    Balaji Govindaraju

    You can certainly open the first OMF which will load into a session and as I recall you can then 'import' another OMF but that will only add the embedded audio files into the list of media files in the "Files" panel.
    I haven't tried it but you could probably continue doing that with each of the other OMFs but if the media is AIF (and it is a good chance) then there probably won't be any BWF data to place the audio correctly on the timeline.
    If you try to do the same in PT (and I'm no PT expert) PT will ask you to save the existing session and open the selected OMF - I could be wrong but not sure how that will happen in PT
    I see the simplest solution as creating a 'reference' (ie not an embedded) OMF - then you can just send the OMF plus the media to whoever you need to without a 2gb restriction
    Failing that you could (and I haven't tried this for a long time) you could import the OMFs into separate sesx sessions and then use AATranslator to append them into a single session - a bit of mucking around but achievable
    My advice is to go with the reference OMF

  • Any way to find out which program has created a job using 'JOB_OPEN'?

    Hi,
    I have some jobs created by some program. The job is incomplete, i.e., the programs which created the job just used 'JOB_OPEN' and it doesn't have any steps.
    Is there any way to find out which program created that incomplete job?
    Thanks in advance.
    Regards,
    Arun Mohan

    Not sure but try this FM
    BP_JOB_SELECT -Returns a table with job(s) details .
    кu03B1ятu03B9к
    Edited by: kartik tarla on Dec 30, 2008 6:50 PM

  • Background Job and Screen

    Hi,
    I've created a selection screen by using se51. In my program I call this screen with "CALL SCREEN XXX'.
    My question is: How to run this report in Backgroung.
    As it's not a standart selection screen (1000) I don't have the option to run it in background.....
    Thank for your help.
    Joseph

    Hi
    I think you should insert the part in START-OF-SELECTION in a new program and so run it in background using FM JOB_OPEN and JOB_CLOSE to schedule the job:
    CALL FUNCTION 'JOB_OPEN'
         JOBNAME  = SY-REPID
      IMPORTING
         JOBCOUNT = TBTCJOB-JOBCOUN.
    SUBMIT <ZREPORT> USER SY-UNAME
                     VIA JOB SY-REPID NUMBER TBTCJOB-JOBCOUN.
    CALL FUNCTION 'JOB_CLOSE'
    mAX

  • Submit in background

    Is there any program to submit in background,  ALV report?
    I tried in job_open and job_close, but nto worked out.

    Hi,
    You need to use the following function modules:
    - JOB_CREATE - create the job
    - JOB_SUBMIT - add a step in the job
    - JOB_CLOSE - to pass the job to the background processing subsystem
    Alternatively, you can use SUBMIT... VIA JOB, which is easier but gives you less control.
    MJ

  • Schedule Jobs with multiple steps via ABAP Program

    Hi,
    I need to schedule multiple programs via background jobs on a daily basis. Since all these jobs are to be run as a single job, the various programs have to be run as steps in a major job.
    I am however not very clear on how this can be done via an ABAP program ( the idea of a program is that various parameters to be passed to each program in the step can be entered dynamically rather than via variants).
    I am using the JOB_OPEN and JOB_CLOSE functions and submitting the programs with selection screen parameters dynamically passed to create a job. I need to do this for various programs as a job step (WITHOUT Variants being defined).
    Can anyone suggest any ideas for this? I have tried out JOB_SUBMIT Function but am not very confident I know what exactly it is for as it asks for a variant.
    Thanks very much,
    Preet

    Hi Preet,
    just to be sure: you know, that variants can be dynamical, too?
    It's quite usual to assign dynamical current date, but it's also possible to add / subtract value and even define own functionality.
    Maybe it's easier to implement a dynamical selection and handle static jobs.
    If you try to plan a job (online or with JOB_SUBMIT), you have to use variants - you can create (or change) them dynamical in beforehand. Only SE38, F8, F9 is creating a temporary variant, so that no saved variant is necessary.
    But if you end up creating variants dynamical, you can change one existing variant, too. Then you can use a static job definition (with periodical starting rule).
    So: have a look, if dynamic variants are enough, otherwise change variants per job.
    Regards,
    Christian

Maybe you are looking for

  • Automatic File Sync/Transfer to PC/E-Mail etc.

    Hi, I have the following request/problem for my nokia 6280. Some days ago I "discovered" the voice recording feature, which I now using more than 20 times a day. I send them to my secretary and she executes my orders. Now I want to automize this file

  • PSE 7 tags and new install questions

    I have PSE7 on an older computer and I've purchased a new computer and would like the tags from the 30000+ images to move over to the new system. I see some possible pitfalls. New OS is Windows 7 and old OS is XP Paths will be different due to the Us

  • Compaq Prepares CQ61-320SA not powering on.. tried hard reset.. :/

    1. Product Name and Number      • Compaq Presario CQ61-320SA  2. Operating System installed (if applicable)      • Windows 7 Home Pre 64-bit  3. Error message (if any)  > Unable to turn on the laptop.. 'Power' light flashing all the time.. AC Adapter

  • Space Designer decay cuts off on Compound Clips?

    I cannot seem to get the Space Designer to properly decay on Compound Clips. The decay cuts off sharply at the end of each nested clip instead of sustaining through the gap like the stock FCP reverb effects. Am I missing something or is this a curren

  • SPFILE location

    We recently upgraded one of our RAC clusters from 10g Rac to 11G RAC GI . We are not using ASM curretnly ( we use Veritas Cluster File system), but after upgrading to 11g RAC GI, ASM instances are created on both nodes eventhough we use Veritas Clust