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

Similar Messages

  • 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

  • Direct Print smartform to printer via  JOB_OPEN function and using SUBMIT

    Hello,
    I can not able to printout from forms . I can able to get spool number but it is not printing directly to printer (printer Output should come automatic). I am getting error message in SP02 as Status ->Waiting    when i check is showing as "Frontend unavailable".
    please find sample code below to test same:
    REPORT  ZTEST_1                                  .
    constants : wc_x type c value 'X'.
    DATA: wv_val(1) TYPE c,
          wv_pripar TYPE pri_params,
          wv_arcpar TYPE arc_params,
          wv_lay   TYPE pri_params-paart value 'DINA4',
          wv_lines TYPE pri_params-linct,
          wv_rows  TYPE pri_params-linsz.
    data: wv_jobname like tbtcjob-jobname.
    data: wv_jobcount like tbtcjob-jobcount,
          wv_host like msxxlist-host.
    data: begin of ws_starttime.
            include structure tbtcstrt.
    data: end of ws_starttime.
    data: wv_starttimeimmediate like btch0000-char1 value 'X',
          wv_flag(1),
          WV_DO_PRINT type i.
    concatenate sy-tcode+0(4) ' ' 'sample test - print'
    into wv_jobname.
    *Job open
      call function 'JOB_OPEN'
           exporting
                delanfrep        = 'X'
                jobname          = wv_jobname
                sdlstrtdt        = sy-datum
                sdlstrttm        = sy-uzeit
           importing
                jobcount         = wv_jobcount
      if sy-subrc eq 0.
    CALL FUNCTION 'GET_PRINT_PARAMETERS'
           EXPORTING
                in_archive_parameters  = wv_arcpar
                in_parameters          = wv_pripar
                LIST_NAME           = 'JOB NAME'
                LIST_TEXT             = 'test_text'
                RECEIVER             = sy-uname
                IMMEDIATELY           = wc_x
                RELEASE               = wc_x
                USER                 = sy-uname
                layout                 = wv_lay
                no_dialog              = wc_x
           IMPORTING
                out_archive_parameters = wv_arcpar
                out_parameters         = wv_pripar
                valid                  = wv_val
    break-point.
    wv_pripar-PRSAP = space.
    wv_pripar-PRIOT = 1.
    wv_pripar-prrec = sy-uname.
    if not wv_val is initial.
    *call external program and pass data
    submit SF_EXAMPLE_01
          USER sy-uname
         via job wv_jobname
         number wv_jobcount
      TO SAP-SPOOL
    SPOOL PARAMETERS wv_pripar
    ARCHIVE PARAMETERS wv_arcpar
    WITHOUT SPOOL DYNPRO
    AND RETURN.
    endif.
    *Close job
      ws_starttime-sdlstrtdt = sy-datum .
      ws_starttime-sdlstrttm = sy-UZEIT.
        ws_starttime-IMSTRTPOS = WC_X .
      call function 'JOB_CLOSE'
           exporting
                event_id             = ws_starttime-eventid
                event_param          = ws_starttime-eventparm
                EVENT_PERIODIC       = space
                jobcount             = wv_jobcount
                jobname              = wv_jobname
                laststrtdt           = ws_starttime-laststrtdt
                laststrttm           = ws_starttime-laststrttm
                prddays              = 0                       "set to 0 not repeat
                prdhours             = 0
                prdmins              = 0
                prdmonths            = 0
                prdweeks             = 0
                sdlstrtdt            = ws_starttime-sdlstrtdt
                sdlstrttm            = ws_starttime-sdlstrttm
                strtimmed            = wv_starttimeimmediate
      endif.

    Hi,
    As far as printing to devices not all devices support Bluetooth. Many devices support Bonjour protocal, IPP. The main print port is 9100. Additionally you can see what IO protocols are supported on a product by looking at the EWS (Embedded WebServer) there should be a networking page with that information.  Port 9100 is your basic print port and different devices will support different formats (PDF, JPEG, PCL5, PCL6). If there is an API you can find (i am not familiar with J2ME availible calls, then you can use those and send the data to port 9100. Again that is the basic path most printers will accept. not all devices support bonjour not all device support bluetooth etc... Hope that helps and good luck.
    I am an HP Employee.

  • Need help with JOB_OPEN, JOB_SUBMIT and JOB_CLOSE

    I am calling a standard Report which popups list of sessions.
    Out of which, i select one session and the data belonging to that session is deleted from data base.
    I need to perform the above task using a single report which consists of  JOB_OPEN, JOB_SUBMIT and JOB_CLOSE function modules.
    I mean i know the session number which i have to select. Where should i pass it and in which FM so that no popup should come and the data is automatically deleted as soon as the report is executed.
    Can anyone tell me how to do this??

    I have clearly mentioned that I am executing a standard report which generates list of sessions.
    SO deleting data from Database tables is the functionality of the report.
    We dont need to worry about that.
    I just need to perform that same functionality using JOB_OPEN, JOB_SUBMIT and JOB_CLOSE
    i.e. is i write submit (reort)
    via job number and return.
    Where should i pass session number???
    My only purpose is no break or halt should be there or i shouldnt select sessions while executing report.
    I just pass session names at the beginning and the report is executed successfully.

  • 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

  • Error While creating a Job using JOB_OPEN

    Hello,
    I am trying to create a job in the output type of a standard transaction.
    But the job creation is failing. While debugging the transaction in update mode, I found out that the JOB_OPEN is coming out in the 'COMMIT WORK'.
    Is there any other way to create a job so that the program executes properly.
    Thanis/Regards,
    Abhijit Anandgaonkar.

    Hi,
    create a RFC function module....and inside the function module...create the batch job..
    in the output type processing program...call the RFC function module in background task..
    Thanks
    Naren

  • Problem in using JOB_OPEN, JOB_SUBMIT & JOB_CLOSE

    Hi,
    I using following code to submit the Job. But Job which is created is getting canceled in SM37 can anybody let me where the error is ?
    I used GET_PRINT_PARAMETERS function module too but same results.
    Thanks in advance.
    DATA: TBTCJOB  TYPE  TBTCJOB,
          NUMBER1 LIKE TBTCJOB-JOBCOUNT,
          authcknam TYPE tbtcjob-authcknam,
          JOBCOUNT LIKE TBTCJOB-JOBCOUNT,
          JOBNAME LIKE TBTCJOB-JOBNAME,
          ARC_PARAMS LIKE ARC_PARAMS,
          OUT_PARAMS LIKE PRI_PARAMS,
          VALID,
          VALID_FOR_SPOOL.
    jobname = '634_1155'.
    CALL FUNCTION 'JOB_OPEN'
      EXPORTING
        jobname          = jobname
        jobclass         = 'A'
      IMPORTING
        jobcount         = jobcount
      EXCEPTIONS
        cant_create_job  = 1
        invalid_job_data = 2
        jobname_missing  = 3
        OTHERS           = 4.
    IF SY-SUBRC EQ 0.
       authcknam = sy-uname.
       CALL FUNCTION 'JOB_SUBMIT'
        EXPORTING
          authcknam               = authcknam
          jobcount                = jobcount
          jobname                 = jobname
    *      PRIPARAMS              = OUT_PARAMS
          report                  = 'RMDATIND'
          variant                 = 'TEST2'
        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.
       data lv_time like sy-uzeit.
       lv_time = sy-uzeit + 10.
        CALL FUNCTION 'JOB_CLOSE'
             EXPORTING
                  JOBCOUNT  = jobcount
                  JOBNAME   = jobname
                  sdlstrtdt = sy-datum
                  sdlstrttm = lv_time
                  STRTIMMED = 'X'
             EXCEPTIONS
                  OTHERS    = 01.
      ENDIF.
    ENDIF.
    Edited by: Thomas Zloch on Jun 15, 2010 6:28 PM

    Hi,
       Thanks for looking in this issue Job log is showing this
    2010/06/15 12:31:00 Job started                                                                                00           516          S
    2010/06/15 12:31:00 Step 001 started (program RMDATIND, variant TEST2, user ID VANNAM)          00           550          S
    2010/06/15 12:31:00 634_1155: This job was started periodically or directly from SM36/SM37           BD           076          I
    2010/06/15 12:31:00 Job 634_1155: Data does not match the job definition; job terminated                 BD           078          E
    2010/06/15 12:31:00 Job cancelled after system exception ERROR_MESSAGE                                   00           564          A

  • Job_open

    Hi ,
        i am running CC11 transaction in the background using the below code, i have created a BDC for the transaction and trying to run this in the background , the log(SM37) is showing the sucess message but the revision is not done.
        CALL FUNCTION 'JOB_OPEN'
                 EXPORTING
                      jobname          = v_jobnm
                 IMPORTING
                      jobcount         = v_jobcnt.
    To run roll of revision
            IF sy-subrc = 0.
              submit zecr via job v_jobnm
              NUMBER v_jobcnt
              with p_matnr = v_matnr
              WITH p_aennr = v_aennr
               AND RETURN.
            ENDIF.
    *end of submit
        CALL FUNCTION 'JOB_CLOSE'
             EXPORTING
                  JOBCOUNT             = V_JOBCNT
                  JOBNAME              = V_JOBNM
                 SDLSTRTDT            = SY-DATUM
                 SDLSTRTTM            = V_TIME.
                   STRTIMMED              = 'X'.
    Thanks & Regards
    Syed

    Hello,
    You have somme programm to trigger your BDC in background.
    search (i don't remember the name) in SE38 RBDC
    Regards
    sebastien

  • JOB_OPEN - SUBMIT - JOB_CLOSE - User Name for the Job

    Hi,
    I have a code like that:
    CALL FUNCTION 'JOB_OPEN'
        EXPORTING
          jobname          = lv_jobname
        IMPORTING
          jobcount         = lv_jobcount
        EXCEPTIONS
          cant_create_job  = 1
          invalid_job_data = 2
          jobname_missing  = 3
          OTHERS           = 4.
    * Call Update PO from Sales Order
      SUBMIT zpcc_mm_upo3
        WITH p_vbeln = puv_vbeln
        USER lc_uname
        VIA JOB lv_jobname NUMBER lv_jobcount
        AND RETURN.
      CALL FUNCTION 'JOB_CLOSE'
        EXPORTING
          jobcount             = lv_jobcount
          jobname              = lv_jobname
          strtimmed            = lc_true
        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.
    In this code as you see I can run the SUBMIT program with a specified user. But the creator of the job always becomes SY-UNAME. So is there a way to specify the user name for a job creator? I don't want to use SY-UNAME.
    Thanks,

    Hio try this way...
    CALL FUNCTION 'JOB_OPEN'
         EXPORTING
           jobname          = lv_jobname
         IMPORTING
           jobcount         = lv_jobcount
         EXCEPTIONS
           cant_create_job  = 1
           invalid_job_data = 2
           jobname_missing  = 3
           OTHERS           = 4.
    "Comment this
    * Call Update PO from Sales Order
       SUBMIT zpcc_mm_upo3
         WITH p_vbeln = puv_vbeln
         USER lc_uname
         VIA JOB lv_jobname NUMBER lv_jobcount
         AND RETURN.
    "Comment end
    * Call function to submit the job
      CALL FUNCTION 'JOB_SUBMIT'
           EXPORTING
                authcknam                   = wa_authchknam        "Pass the Other User name you want
                jobcount                    =  lv_jobcount
                jobname                     = lv_jobname
                REPORT                      = 'zpcc_mm_upo3'
                VARIANT                     = jobs-variant  "Create Varaqint
                PRIPARAMS                   = wa_PRI_PARAMS
          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
       CALL FUNCTION 'JOB_CLOSE'
         EXPORTING
           jobcount             = lv_jobcount
           jobname              = lv_jobname
           strtimmed            = lc_true
         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.
    Prabhudas

  • Using JOB_OPEN, SUBMIT, CLOSE

    Hi,
    I have a report:
    data: sdate    type sy-datum,
          stime    type sy-uzeit,
          jobcount like tbtcjob-jobcount,
          jobname  like tbtcjob-jobname.
    jobname = 'my_name'.
    call function 'JOB_OPEN'
      exporting
        jobname   = jobname
      importing
        jobcount   = jobcount.
    CALL FUNCTION 'JOB_SUBMIT'
         exporting
           authcknam    = SY-UNAME
           jobcount        = jobcount
           jobname        = jobname
           REPORT       = 'my_report'.
    sdate = sy-datum.
    stime = sy-uzeit + 30.
    call function 'JOB_CLOSE'
      exporting
        jobcount    = jobcount
        jobname    = jobname
        sdlstrtdt     = sdate
        sdlstrttm    = stime.
    I'm getting error
    'Printer not suitable for job step. Automatic printing not possible.'
    I have no idea what i'm doing wrong.
    Can I use these FMs to set and call my report in a job.
    What has to do with printing?
    I would be grateful for any help.

    Hello,
    Check this report:
    *& Report  ZYTEST31                                                    *
    REPORT  zytest31                      .
    DATA : v_jobhead LIKE tbtcjob.
    *DATA : v_jobname LIKE tbtcjob-jobname.
    DATA : v_jobcount LIKE tbtcjob-jobcount.
    DATA : v_eventparm LIKE tbtcjob-eventparm.
    DATA : v_flg_released TYPE c.
    DATA: e_error.
    DATA: running LIKE tbtcv-run.
    TYPES: esp1_boolean LIKE boole-boole.
    CONSTANTS: esp1_false TYPE esp1_boolean VALUE ' ',
               esp1_true  TYPE esp1_boolean VALUE 'X'.
    CONSTANTS: true  TYPE boolean VALUE esp1_true,
               false TYPE boolean VALUE esp1_false.
    PARAMETERS: v_jobnam LIKE tbtcjob-jobname,
                v_report LIKE sy-repid,
                v_varian LIKE  raldb-variant,
                v_uname  LIKE sy-uname.
    *data: date like sy-datum. " value '20030101'. "syst-datum.
    *data: p_time like sy-uzeit.
    *data: p_date_dif type p.
    START-OF-SELECTION.
    *break shirt.
    *      p_time = '00:00:01'.
    *      CALL FUNCTION 'SD_DATETIME_DIFFERENCE'
    *        EXPORTING
    *          DATE1                  = date "wa_eket-eindt
    *          TIME1                  = p_time
    *          DATE2                  = date "i_mkpf-budat
    *          TIME2                  = p_time
    *        IMPORTING
    *          DATEDIFF               = p_date_dif
    **         TIMEDIFF               =
    **         EARLIEST               =
    *       EXCEPTIONS
    *         INVALID_DATETIME       = 1
    *         OTHERS                 = 2.
    *exit.
    * add the new job
      CALL FUNCTION 'JOB_OPEN'
           EXPORTING
    *            delanfrep        = 'X'
                jobname          = v_jobnam
           IMPORTING
                jobcount         = v_jobcount
           EXCEPTIONS
                cant_create_job  = 1
                invalid_job_data = 2
                jobname_missing  = 3
                OTHERS           = 4.
      IF sy-subrc <> 0.
        e_error = true.
      ELSE.
        CALL FUNCTION 'JOB_SUBMIT'
             EXPORTING
                  authcknam               = v_uname
                  jobcount                = v_jobcount
                  jobname                 = v_jobnam
                  report                  = v_report
                  variant                 = v_varian
             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.
          e_error = true.
        ELSE.
          CALL FUNCTION 'JOB_CLOSE'
               EXPORTING
    *               EVENT_ID                    = IC_WWI_WORKPROCESS_EVENT
    *               EVENT_PARAM                 = V_EVENTPARM
    *               EVENT_PERIODIC              = 'X'
                    jobcount                    = v_jobcount
                    jobname                     = v_jobnam
                    strtimmed                   = 'X'
               IMPORTING
                    job_was_released            = v_flg_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 sy-subrc <> 0.
            e_error = true.
          ELSE.
            DO.
              CALL FUNCTION 'SHOW_JOBSTATE'
                EXPORTING
                  jobcount               = v_jobcount
                  jobname                = v_jobnam
    *            IMPORTING
    *         ABORTED                =
    *         FINISHED               =
    *         PRELIMINARY            =
    *         READY                  =
    *              running                =
    *         SCHEDULED              =
               EXCEPTIONS
                 jobcount_missing       = 1
                 jobname_missing        = 2
                 job_notex              = 3
                 OTHERS                 = 4.
              IF sy-subrc <> 0.
                e_error = true.
                MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                        WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
              ENDIF.
              IF running = space.
                EXIT.
              ELSE.
                break shirt.
              ENDIF.
            ENDDO.
          ENDIF.
        ENDIF.
      ENDIF.
    Vasanth

  • JOB_OPEN, SUBMIT REPORT VIA JOB, JOB_CLOSE, How to get result?

    Hi Friends,
    I am calling reports using jobs as calling job_open, submit report via job.., and job_close. But I want to the output/result of the report. How can I do this?
    Thanks.

    Hello nkara,
    Welcome to SDN!!!
    Check this thread:
    background grid
    REgards,
    Vasanth

  • Job_open,job_close

    hello
    plz let me know how to use job_open,jib_sumbit,job_close,
    and the function modules related to it
    thanks
    aafaq husain

    Hi aafaqhusain,
    1. we can use like this
    2.
    report abc.
    BREAK-POINT.
    DATA  : JN(32) TYPE C.
    JN  = 'JOB001'.
    BREAK-POINT.
    DATA : J(8) TYPE C.
    CALL FUNCTION 'JOB_OPEN'
      EXPORTING
      DELANFREP              = ' '
      JOBGROUP               = ' '
        jobname                = JN
      SDLSTRTDT              = NO_DATE
      SDLSTRTTM              = NO_TIME
      JOBCLASS               =
    IMPORTING
       JOBCOUNT               = J
    CHANGING
      RET                    =
    EXCEPTIONS
      CANT_CREATE_JOB        = 1
      INVALID_JOB_DATA       = 2
      JOBNAME_MISSING        = 3
      OTHERS                 = 4
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    DATA : P TYPE PRI_PARAMS.
    P-PDEST = 'PRINTER'.
    P-PDEST = 'LOCL'.
    CALL FUNCTION 'GET_PRINT_PARAMETERS'
           EXPORTING  NO_DIALOG             = 'X'
                      MODE                  = 'CURRENT'
                     NEW_LIST_ID           = $PRNEW
           IMPORTING  OUT_PARAMETERS       =  P.
    CALL FUNCTION 'JOB_SUBMIT'
      EXPORTING
      ARCPARAMS                         =
        authcknam                         = 'MAMIT'
      COMMANDNAME                       = ' '
      OPERATINGSYSTEM                   = ' '
      EXTPGM_NAME                       = ' '
      EXTPGM_PARAM                      = ' '
      EXTPGM_SET_TRACE_ON               = ' '
      EXTPGM_STDERR_IN_JOBLOG           = 'X'
      EXTPGM_STDOUT_IN_JOBLOG           = 'X'
      EXTPGM_SYSTEM                     = ' '
      EXTPGM_RFCDEST                    = ' '
      EXTPGM_WAIT_FOR_TERMINATION       = 'X'
        jobcount                          = J
        jobname                           = JN
      LANGUAGE                          = SY-LANGU
       PRIPARAMS                         = P
       REPORT                            = 'HINCF160'
       VARIANT                           = 'A'
    IMPORTING
      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
      AT_OPMODE                         = ' '
      AT_OPMODE_PERIODIC                = ' '
      CALENDAR_ID                       = ' '
      EVENT_ID                          = ' '
      EVENT_PARAM                       = ' '
      EVENT_PERIODIC                    = ' '
        jobcount                          = J
        jobname                           = JN
      LASTSTRTDT                        = NO_DATE
      LASTSTRTTM                        = NO_TIME
      PRDDAYS                           = 0
      PRDHOURS                          = 0
      PRDMINS                           = 0
      PRDMONTHS                         = 0
      PRDWEEKS                          = 0
      PREDJOB_CHECKSTAT                 = ' '
      PRED_JOBCOUNT                     = ' '
      PRED_JOBNAME                      = ' '
      SDLSTRTDT                         = NO_DATE
      SDLSTRTTM                         = NO_TIME
      STARTDATE_RESTRICTION             = BTC_PROCESS_ALWAYS
       STRTIMMED                         = 'X'
      TARGETSYSTEM                      = ' '
      START_ON_WORKDAY_NOT_BEFORE       = SY-DATUM
      START_ON_WORKDAY_NR               = 0
      WORKDAY_COUNT_DIRECTION           = 0
      RECIPIENT_OBJ                     =
      TARGETSERVER                      = ' '
      DONT_RELEASE                      = ' '
      TARGETGROUP                       = ' '
      DIRECT_START                      =
    IMPORTING
      JOB_WAS_RELEASED                  =
    CHANGING
      RET                               =
    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.
    ENDIF.
    BREAK-POINT.
    regards,
    amit m.

  • 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.

  • JOB_OPEN JOB_SUBMIT JOB_CLOSE

    Hello Experts,
    I have a requirement where I want to execute a portion of my code in the background inorder to reduce the performance issue.
    This can be done through JOB_OPEN JOB_SUBMIT JOB_CLOSE command which generates a new JOB in the  background mode.
    JOB_OPEN
    JOB_SUBMIT
    JOB_CLOSE
    Question : How can I pass the internal table with the values through JOB_SUBMIT??
    Thanking you all in advance,
    Warm Regards,
    gayatri.

    Hi,
    * Get Print Parameters
      CALL FUNCTION 'GET_PRINT_PARAMETERS'
        EXPORTING
          no_dialog      = 'X'
        IMPORTING
          valid          = g_valid
          out_parameters = gs_params.
    * Open Job
    *  g_stim = '185800'.
      CONDENSE g_var6.
      CONCATENATE g_var8+6(2)
                  g_var8+3(2)
                  g_var8(2)
              INTO g_stim.
      g_sdat = sy-datum .
      CALL FUNCTION 'JOB_OPEN'
        EXPORTING
          jobname          = g_job
          sdlstrtdt        = sy-datum
          sdlstrttm        = g_stim
        IMPORTING
          jobcount         = g_jobcount
        EXCEPTIONS
          cant_create_job  = 1
          invalid_job_data = 2
          jobname_missing  = 3
          OTHERS           = 4.
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      CONDENSE : g_var1,
                 g_var2,
                 g_var3,
                 g_var4,
                 g_var5,
                 g_var6,
                 g_var7,
                 g_var8.
      gs_rspar-selname = 'P_USER'.
      gs_rspar-kind = 'P'.
      gs_rspar-low  = g_var1.
      APPEND gs_rspar TO gt_rspar.
      gs_rspar-selname = 'P_PWD'.
      gs_rspar-kind = 'P'.
      gs_rspar-low  = g_var2.
      APPEND gs_rspar TO gt_rspar.
      gs_rspar-selname = 'P_HOST'.
      gs_rspar-kind = 'P'.
      gs_rspar-low  = g_var3.
      APPEND gs_rspar TO gt_rspar.
      gs_rspar-selname = 'P_FILE'.
      gs_rspar-kind = 'P'.
      gs_rspar-low  = g_var4+2.
      APPEND gs_rspar TO gt_rspar.
      gs_rspar-selname = 'P_FNAME'.
      gs_rspar-kind = 'P'.
      gs_rspar-low  = g_var5.
      APPEND gs_rspar TO gt_rspar.
      gs_rspar-selname = 'P_FILE1'.
      gs_rspar-kind = 'P'.
      gs_rspar-low  = g_var6.
      APPEND gs_rspar TO gt_rspar.
      gs_rspar-selname = 'P_FILE2'.
      gs_rspar-kind = 'P'.
      gs_rspar-low  = g_var7.
      APPEND gs_rspar TO gt_rspar.
      gs_rspar-selname = 'P_DEST'.
      gs_rspar-kind = 'P'.
      gs_rspar-low  = 'SAPFTPA'.
      APPEND gs_rspar TO gt_rspar.
      gs_rspar-selname = 'P_COMP'.    <----- This are Parameter value to be passed in background Program
      gs_rspar-kind = 'P'.
      gs_rspar-low  = 'N'.
      APPEND gs_rspar TO gt_rspar.
      SUBMIT ztest123 VIA JOB  g_job
           NUMBER  g_jobcount
    *                  USING SELECTION-SCREEN
                      WITH SELECTION-TABLE gt_rspar
                      TO SAP-SPOOL WITHOUT SPOOL DYNPRO
           SPOOL PARAMETERS gs_params
                      AND RETURN.
      CALL FUNCTION 'JOB_CLOSE'
          EXPORTING
            jobcount                          = g_jobcount
            jobname                           = g_job
            sdlstrtdt                         = g_sdat
            sdlstrttm                         = g_stim
    *     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

  • 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

Maybe you are looking for