'INVALID_JOBDATA' in JOB_SUBMIT.

Hi All,
I am using JOB_OPEN, JOB_SUBMIT, JOB_CLOSE to schedule background job .
but it is throwing exception saying 'INVALID_JOBDATA' in FM JOB_SUBMIT.
I also tried 'BP_JOB_CREATE' still it is throwing the same exception.
Can anybody tell me the work around to this.
Thanks ,
Swarup

Hello,
Refer this programs how they are using these 3 FMs pass the parameters according to u r requirement.
RTXWQU01
RUTCNVSC
RUTCNVSK
RUTMSJOB
RUTTABSJ
RUTTABSQ
RV15B001
RV15F001
RV56BPGI
RV60SBAT
RWMFA200
RWMFA210
RWMFA300
RWS41F04
RZDEBIV0

Similar Messages

  • Printing in Background.

    Hello,
              I am trying to print a report in the background but i am getting a runtime error. The exception invalid_jobdata on job_submit FM is raised.
    this is the code i have written.
    DATA: P_JOBCNT LIKE TBTCJOB-JOBCOUNT,
          L_RELEASE(1) TYPE c.
    DATA: PARAMS LIKE PRI_PARAMS,
    DAYS(1) TYPE N VALUE 2,
    COUNT(3) TYPE N VALUE 1,
    VALID TYPE C.
    CALL FUNCTION 'GET_PRINT_PARAMETERS'
    EXPORTING
       COPIES                       = COUNT
       COVER_PAGE                   = 'X'
       DEPARTMENT                   = 'System'
       DESTINATION                  = 'LOCL'
       EXPIRATION                   = DAYS
      IMMEDIATELY                  = 'X'
       LAYOUT                       = 'X_PAPER'
       LINE_COUNT                   = 65
       LINE_SIZE                    = 70
       LIST_NAME                    = 'ZSALESREPORT'
       LIST_TEXT                    = 'SALES REPORT'
       NEW_LIST_ID                  = 'X'
       NO_DIALOG                    = ' '
       RECEIVER                     = sy-uname
       RELEASE                      = 'X'
      REPORT                       = C_CHAR_UNKNOWN
       SAP_COVER_PAGE               = ''
      HOST_COVER_PAGE              = C_CHAR_UNKNOWN
      PRIORITY                     = C_NUM1_UNKNOWN
      SAP_OBJECT                   = C_CHAR_UNKNOWN
      TYPE                         = C_CHAR_UNKNOWN
       USER                         = SY-UNAME
    IMPORTING
       OUT_PARAMETERS               = PARAMS
       VALID                        = VALID
    EXCEPTIONS
      ARCHIVE_INFO_NOT_FOUND       = 1
      INVALID_PRINT_PARAMS         = 2
      INVALID_ARCHIVE_PARAMS       = 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.
    IF VALID <> SPACE.
       CALL FUNCTION 'JOB_OPEN'
         EXPORTING
           JOBNAME                = 'ZSALESREPORT1'
        IMPORTING
          JOBCOUNT               = P_JOBCNT
        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.
    CALL FUNCTION 'JOB_SUBMIT'
      EXPORTING
      ARCPARAMS                         =
        AUTHCKNAM                         = SY-UNAME
      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                          = P_JOBCNT
        JOBNAME                           = 'ZSALESREPORT1'
      LANGUAGE                          = SY-LANGU
       PRIPARAMS                         = PARAMS
       REPORT                            = 'ZSALESREPORT'
       VARIANT                           = 'TEST'
    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
           JOBCOUNT                          = P_JOBCNT
           JOBNAME                           = 'ZSALESREPORT1'
           STRTIMMED                         = 'X'
           PRDMINS                          = 15
        IMPORTING
          JOB_WAS_RELEASED                  = L_RELEASE
        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.
       ENDIF.
    ENDFORM.
    THANKS IN ADVANCE,
    KB

    Hi Kumar
    You can try this way:
    1. In the second program, before the displaying the output use statement: NEW-PAGE PRINT ON. This will open a spool.
    2. Once output is finished, close the spool by NEW-PAGE PRINT OFF.
    3. Get the value of SYST-SPONO.
    4. This will hold the spool number created.
    5. Use FM: RSPO_OUTPUT_SPOOL_REQUEST to issue the print.
    Sample:
              CALL FUNCTION 'RSPO_OUTPUT_SPOOL_REQUEST'
                EXPORTING
                  device           = <printer>
                  spool_request_id = <request>.
    Hope this helps.
    Kind Regards
    Eswar

  • Invalid_JOBData = 3 in JOB_SUBMIT

    Hi Folks,
    I'm scheduling the job but while JOB_SUBMIT i'm getting Invalid_jobdata. I have searched in SDN for help but i could find any relevant answer to my issue.
    PARAMETERS: p_varian LIKE v_bicu-variant NO-DISPLAY
                        DEFAULT 'JE_UPLOAD_A'.
    CALL FUNCTION 'JOB_SUBMIT'
          EXPORTING
            authcknam               = syst-uname
            jobcount                = job_count
            jobname                 = p_jobnam
            report                  = 'RFBIBL00'
            variant                 = p_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.
    Any help on this.
    Regards
    VEnk@

    Venkat Reddy wrote:
    > Yes through debugging itself i got know tht Invalid Jobdata was coming, wondering in many sites they gave analysis as VARIANT problem could it be tht.??
    By debugging i mean debugging the 'JOB_SUBMIT' function. Did you try it before posting the qn?

  • 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

  • Error return from JOB_SUBMIT / SUBMIT when running with another  username

    I am trying to run the program RSBDCSUB after setting up a BDC session.
    Due to our authorisations in the production environment I have to run this program under a generic user (l_ernam) that has the authorisations as most users do not.
    Here is the code I am using:
    CALL FUNCTION 'JOB_OPEN'
    EXPORTING
    jobname = l_jobname
    IMPORTING
    JOBCOUNT = l_jobcount
    CHANGING
    RET = l_ret
    EXCEPTIONS
    CANT_CREATE_JOB = 1
    INVALID_JOB_DATA = 2
    JOBNAME_MISSING = 3
    OTHERS = 4
    Submit RSBDCSUB And Return
    User l_Ernam
    Via Job l_Jobname Number l_Jobcount
    with mappe = l_mappe .
    CALL FUNCTION 'JOB_CLOSE'
    EXPORTING
    jobcount = l_jobcount
    jobname = l_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
    OTHERS = 8
    When I run this with a restricted user I get a return of 8 from the submit rsbdcsub - has anyone seen this before and can you offer advice on how to solve it?.
    I have also tried using JOB_SUBMIT with the following settings instead
    CALL FUNCTION 'JOB_SUBMIT'
    EXPORTING
    authcknam = l_ernam
    jobcount = l_jobcount
    jobname = l_jobname
    REPORT = l_report
    VARIANT = l_variant
    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
    and in this case get a return of 3 (INVALID_JOBDATA) - anyone any ideas as to how to resolve this?.

    Hello Caroline,
    I do not know whether this issue is resolved at your end. I faced a similar problem and found that User Type for the generic user(l_Ernam) was the cause.
    We had initially defined User Type for the generic user as a 'Communication' and it was giving return code 8 after SUBMIT.
    We later changed the User Type to 'System' and it worked as intended. Job was created under the name of the user who executed the main program and the steps added using the generic user(l_Ernam).
    Please note that the user who is running the main program will need authorization to add job steps using the generic user.
    With Kind Regards,
    Jatin.

  • Invalid_jobdata when submitting job with rfc user

    Hi,
    I've created a function module in the erp system to remotly trigger a report program by a bw prossess chain.
    When running in the forground it works fine, but the runtime is so long that I want it as a background job.
    So I call job_open, job_submit, job_close in the function module. When I test the function module in the erp system with my dev user it opens a new job, adds a step and release correctly. It also runs fine if I intercept it in the debugger and change sy-uname to aleremote (the standard rfc user).
    It does not work when it's acctually called rfc from the bw system. The job is opened, but job_submit throws invalid_jobdata.
    Could this have anything to do with rfc or the executing user (which is of type SYSTEM)?

    I've caught the execption so there is no dump, but I'm unable to determine why the function module job_submit gives invalid_jobdata only when the executing user is the aleremote user and only when the call originated (the call to my module) from a remote system (the module job_submit is called locally thru my module). Authorization for the user is sap_all, but I was woundering maybe the user type system could be a problem?

  • Passing variant values in job_submit FM

    Hi Guys,
                  I am running a report in background using job_submit FM.
    Currently I am using Get and Set parameters to pass selection screen values.
    But these values are not effective when run in background.
    If variant is an option, how to populate the variant from selection screen values.
    Thanks

    Hi,
      U follow the given code. If u have taken varinat as parameter then ok.
    other wise u have to pass rs_create_varaint*  function module in the program.
    DATA : v_jobhead LIKE tbtcjob.
    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.
    START-OF-SELECTION.
      CALL FUNCTION 'JOB_OPEN'
           EXPORTING
                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
                    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
               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.
             endif.
               enddo.
            endif.
            endif.
        endif.
    Regards,
    Naveen M.

  • 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

  • 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

  • How to do job_submit on a program which calls a custom FM?

    Hi all,
    I am doing a job_open, job_submit and job_close to submit a FM in background.
    Now, how do I do a job_submit for a program which contains the FM that doing the real processing?
    Details:
    Program ZNSC_WRAP_RMD contains call function "YXAPY_REVIEW_MASTER_DATA'
    CALL FUNCTION 'YXAPY_REVIEW_MASTER_DATA'
        EXPORTING
          i_pay_area                        = ' '
        I_CHECK_OPTION                    =
        I_GUI_ENABLE                      = ' '
        I_PERNR                           =
       IMPORTING
        E_LOCK_EMP_TBL_ERROR              =
        E_TIME_RECON_TBL                  =
        E_UNAPPROVED_TIME_TBL_ERROR       =
        E_WAGE_TYPE_TBL                   =
        E_MISSING_INFO_TBL_ERROR          =
         E_RETURN                          = e_return
        tables
          t_return                          = t_return
    Any idea?

    A job running in the background can not and should not use the frontend resources example GUI.
    In your function module I see a parameter * I_GUI_ENABLE = ' '. Check it's usage and make sure GUI (and frontend processes) are disabled for the job to run in the back ground.
    Any direct or indirect use of classes or FM calls which require frontend cannot execute in background as a job.
    Regards,
    Aabhas

  • 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

  • Schedule a program with JOB_SUBMIT

    Hi Friends,
    I need to execute a program using function modules JOB_OPEN, JOB_SUBMIT, JOB_CLOSE when ever i executed
    (i.e; similar to Background scheduling immediatly using SM36, sm37)
    please help me in the code,
    i have written a sample program using JOB_OPEN, JOB_SUBMIT, JOB_CLOSE function modules,
    but in SP01, i am able to see many jobs under my user.
    How can i avoid multiple Background jobs triggering when i execute a program once using above function modules.
    Thanks in Advance,
    Ganesh

    CALL FUNCTION 'JOB_OPEN'
               EXPORTING
                    jobname  = <JOB NAME>
               IMPORTING
                    jobcount = tbtcjob-jobcount
               EXCEPTIONS
                    OTHERS   = 01.
          IF sy-subrc = 0.
            repid = <REPORT NAME>.
            CALL FUNCTION 'JOB_SUBMIT'
                 EXPORTING
                      authcknam = tbtcjob-authcknam
                      jobcount  = tbtcjob-jobcount
                      jobname   = tbtcjob-jobname
                      report    = repid
                      variant   = raldb-variant
                 EXCEPTIONS
                      OTHERS    = 01.
            IF sy-subrc = 0.
              CALL FUNCTION 'JOB_CLOSE'
                   EXPORTING
                        jobname   = tbtcjob-jobname
                        jobcount  = tbtcjob-jobcount
                        strtimmed = 'X'
                   EXCEPTIONS
                        OTHERS    = 01.
            ENDIF.
          ENDIF.

  • Scheduling a background job using Job_Submit and Job_Close FM

    Hi Guys,
                  I am calling a report in background using Job_Submit and Job_Close FM's.
    I am not providing start time and date in the Job_close FM, in this case, when the job will be scheduled to start.
    Even after an hour, job status is still scheduled.
    I am not exporting variant, since I am using memory ID.
    Thanks
    Edited by: sapgeek007 on May 11, 2009 4:11 AM

    In Job_close fm use the parameter 'STRTIMMED'
    CALL FUNCTION 'JOB_CLOSE'
      EXPORTING
        jobcount                          = LV_NUMBER
        jobname                           = LV_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
       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.
    That would start the background job immediately.
    Regards,
    Deepak

Maybe you are looking for