Can a FM be scheduled like a job?

Hi All,
Can we schedule a FM or RFC FM, the way we schedule a job?
If yes, how can we do it?
Thanks and Regards,
Ankit

Hi,
yes we can schedule using the following Function module
JOB_OPEN
JOB_SUBMIT
JOB_CLOSE
please check out the following program for JOB_OPEN
JOBNAME = 'Freely selectable name for the job(s) you create'.
CALL FUNCTION 'JOB_OPEN'
EXPORTING
JOBNAME = JOBNAME
IMPORTING
JOBCOUNT = JOBNUMBER
EXCEPTIONS
CANT_CREATE_JOB = 01
INVALID_JOB_DATA = 02
JOBNAME_MISSING = 03
OTHERS = 99.
IF SY-SUBRC > 0.
<Error processing>
ENDIF.
Check out the following program for JOB_CLOSE
STARTDATE = '19970101'.
STARTTIME = '160000'.
LASTSTARTDATE = '19970101'.
LASTSTARTTIME = '180000'.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
JOBCOUNT = JOBNUMBER " Job identification: number
JOBNAME = JOBNAME " and name.
SDLSTRTDT = STARTDATE " Start of start-time...
SDLSTRTTM = STARTTIME " window
LASTSTRTDT = LASTSTARTDATE " Optional: end of...
LASTSTRTTM = LASTSTARTTIME " start-time window
PRDMONTHS = '1' " Restart at intervals of
PRDWEEKS = '1' " the sum of the PRD*
PRDDAYS = '1' " parameters
PRDHOURS = '1'
PRDMINS = '1'
STARTDATE_RESTRICTION = BTC_DONT_PROCESS_ON_HOLIDAY
" Restrict job start to work
" days; don't start job if
" scheduled on holiday.
" Other values:
" BTC_PROCESS_BEFORE_HOLIDAY
" BTC_PROCESS_AFTER_HOLIDAY
CALENDAR_ID = '01' " ID of R/3 factory calendar
" for determining workdays
TARGETSYSTEM = 'hs0011' " Optional: name of the host
" system on which the job is
" to run. Set only if
" absolutely required.
" Example: A required tape
" drive is accessible only
" from a single host system.
IMPORTING
JOB_WAS_RELEASED = JOB_RELEASED " If user has authorization
" to release jobs to run, job
" is automatically released
" when it is scheduled. This
" field is set to 'x' if the
" job has been released.
" Otherwise, the job is sche-
" duled but must be released
" by an administrator before
" it can be started.
EXCEPTIONS
INVALID_STARTDATE = 01
JOBNAME_MISSING = 02
JOB_CLOSE_FAILED = 03
JOB_NOSTEPS = 04
JOB_NOTEX = 05
LOCK_FAILED = 06
OTHERS = 99.
IF SY-SUBRC > 0.
<Error processing>
ENDIF.
check out the sample program which uses all the three modules at the same time
REPORT ZMAILSPOOL.
INCLUDE LBTCHDEF.
Include the Business Object Repository object
INCLUDE <CNTN01>.
DATA ABAPNM LIKE SY-REPID.
DATA BEGIN OF LOCAL_JOB.
INCLUDE STRUCTURE TBTCJOB.
DATA END OF LOCAL_JOB.
DATA BEGIN OF LOCAL_STEP_TBL OCCURS 10.
INCLUDE STRUCTURE TBTCSTEP.
DATA END OF LOCAL_STEP_TBL.
Data declarations for the mail recipient
DATA RECIPIENT TYPE SWC_OBJECT.
DATA RECIPIENT_OBJ LIKE SWOTOBJID.
SWC_CONTAINER CONTAINER.
Data declarations for the background job
PARAMETERS ABAPNAME(20) DEFAULT 'ZTEST1'.
PARAMETERS EMPFNAME LIKE SY-UNAME DEFAULT SY-UNAME.
ABAPNM = ABAPNAME.
LOCAL_JOB-JOBNAME = ABAPNAME.
Generate recipient object (see report RSSOKIF1 for an example)
1. Create the recipient:
IF EMPFNAME <> SPACE.
"** 1.1 Generate an object reference to a recipient object
SWC_CREATE_OBJECT RECIPIENT 'RECIPIENT' SPACE.
"** 1.2 Write the import parameters for method
"** recipient.createaddress into the container
"** and empty the container
SWC_CLEAR_CONTAINER CONTAINER.
"** Set address element (internal user 'JSMITH')
SWC_SET_ELEMENT CONTAINER 'AddressString' EMPFNAME.
"** Set address type (internal user)
SWC_SET_ELEMENT CONTAINER 'TypeId' 'B'.
"** 1.3 Call the method recipient.createaddress
SWC_CALL_METHOD RECIPIENT 'CreateAddress' CONTAINER.
"** Issue any error message generated by a method exception
IF SY-SUBRC NE 0.
MESSAGE ID SY-MSGID TYPE 'E' NUMBER SY-MSGNO.
ENDIF.
SWC_CALL_METHOD RECIPIENT 'Save' CONTAINER.
SWC_OBJECT_TO_PERSISTENT RECIPIENT RECIPIENT_OBJ.
ENDIF.
Recipient has been generated and is ready for use in a
background job
CALL FUNCTION 'JOB_OPEN'
     exporting
     DELANFREP              = ' '
     JOBGROUP               = ' '
       jobname                = LOCAL_JOB-JOBNAME
     SDLSTRTDT              = NO_DATE
     SDLSTRTTM              = NO_TIME
     IMPORTING
       JOBCOUNT               = LOCAL_JOB-JOBCOUNT
     EXCEPTIONS
       CANT_CREATE_JOB        = 1
       INVALID_JOB_DATA       = 2
       JOBNAME_MISSING        = 3
       OTHERS                 = 4
   if sy-subrc <> 0.
      WRITE: / 'JOB_OPEN PROBLEM ', SY-SUBRC.
   ELSE.
      WRITE: / 'JOB OPEN SUCCESS',
                                  LOCAL_JOB-JOBNAME, LOCAL_JOB-JOBCOUNT.
   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                          = LOCAL_JOB-JOBCOUNT
       jobname                           = LOCAL_JOB-JOBNAME
     LANGUAGE                          = SY-LANGU
     PRIPARAMS                         = ' '
       REPORT                            = ABAPNM
     REPORT                            = 'ZTEST1'
     VARIANT                           = ' '
   IMPORTING
     STEP_NUMBER                       = LOCAL_JOB-STEPCOUNT
     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.
      WRITE: / 'JOB_SUBMIT PROBLEM ', LOCAL_JOB-JOBCOUNT,
               LOCAL_JOB-JOBNAME, ABAPNAME, SY-SUBRC.
   endif.
IF EMPFNAME <> SPACE.
CALL FUNCTION 'JOB_CLOSE'
  exporting
  AT_OPMODE                         = ' '
  AT_OPMODE_PERIODIC                = ' '
  CALENDAR_ID                       = ' '
  EVENT_ID                          = ' '
  EVENT_PARAM                       = ' '
  EVENT_PERIODIC                    = ' '
    jobcount                          = LOCAL_JOB-JOBCOUNT
    jobname                           = LOCAL_JOB-JOBNAME
  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                     = RECIPIENT_OBJ
  TARGETSERVER                      = ' '
  DONT_RELEASE                      = ' '
IMPORTING
  JOB_WAS_RELEASED                  = 'X'
  EXCEPTIONS
    CANT_START_IMMEDIATE              = 1
    INVALID_STARTDATE                 = 2
    JOBNAME_MISSING                   = 3
    JOB_CLOSE_FAILED                  = 4
    JOB_NOSTEPS                       = 5
    JOB_NOTEX                         = 6
    LOCK_FAILED                       = 7
    OTHERS                            = 8
IF ( SY-SUBRC <> 0 ).
  WRITE: / 'Job_Close Problem:', ABAPNAME, SY-SUBRC.
ELSE.
  WRITE: / 'Job_Close done'.
ENDIF.
ELSE. "no empfname
ENDIF.
**************please reward points if the information is helpful to you******************

Similar Messages

  • Help with : How Can I know the schedule for a JOB, and How Can I Change?

    Hi
       I have a job and I know the name...I review in table TBTCO and I saw that this jobs is schedule at 11:00 AM and at 4:00 PM, but I need to change the schedule for this job..and that this job will execute al least four times during the day...I don´t know how can I change the schedule??
        I was thinking that if I  run the transaction directly I can run, Im not sure, because I try to do in QAS environment... I when I try to run the program..the system doesn´t do anything..this mean I cant execute with F8, such as if I should be complete a parameter, but all the fields are completed.
         Thank you for your help, I promese that I will gice you points for your help.
    Alice

    Thank you at all.
    I was reviewing the options that you send me, but Im confused about... if its possible edit the schedule that this job has in this moment, because if I enter the transaction SM36 or try to see SM37..in production environment I can´t see this schedule...
    And Im not sure to do the correct steps to create something new... in QAS environment..I can´´t see this job.
    All of yours help are really important
    Thank you again!
    Alice

  • Can MC.9 be scheduled as background job?

    Hi experts,
       I would like to schedule MC.9 to run monthly. However, I find that no spool list is generated for the background job. I wonder if there is any way to make it to run in backgroud mode with result shown in spool. Or is there any similiar report which serves the same purpose?
       Thanks in advance. Points will be awarded for useful answers.

    If I am not wrong, Spool generation depends on your system settings. I am sure that I have executed all MC** reports and got the spool list. Chk your basis administrator for your system config.

  • How can i modifty the schedule of a Job in R3

    Hi all,
    i must modify the Schedule and the Variant of a job in R3, whats the transacction? i just know the name of the Job "JOB COSTOS FLEXIBLES", whats the first step? i m looking for this job in the SM36 but doesnt appear to modify, just tocreate new one, but i dont want this, i want modify the schedule and the variant, please help guys

    Place cursor (mouse) on the job name in SM36 or SM37 and hit Ctrl + F11.

  • How can you get the schedule of a single reoccurring job with Restart ability in Redwood to pause when it has failed...?

    We need the Request Restart ability when scheduling a single reoccurring job in Redwood. Most of our jobs are scheduled in CHAINs which offers the Final Status Handler on Step level, and the schedule is "paused" when a job in the CHAIN has failed ( the next instance does not populate until the OP MSG has been Replied to) , and once the OPERATOR message is replied to, the CHAIN can resume running again ( desired ) . But we need this same ability when scheduling a single job not in a CHAIN. In our testing, we set up a job with Request Restart chosen on the Error , Killed and Unknown selections on the Restart Behavior Tab. But we found when a job is scheduled say once a day at 8AM, and when it fails, an OPERATOR msg appears allowing a Restart choice ( desired), but the next day's schedule also populates ( undesired) and we do NOT want the schedule to continue on yet because we need a chance to fix the error before the next insance runs for business reasons. So how can you get the schedule of a single reoccurring job with Restart ability in Redwood to pause when it has failed...?

    Hello Fran,
    You can wrap the job chain in a master job chain in the first step and set the final status handler there.
    You can also set the Restart Behavior to 'Stop Submit Frame', in that case you will have to resubmit the job once you are finished troubleshooting.
    Regards Gerben

  • How can we schedule the finished job in SM37 ?

    Hi,
    I need to schedule all the jobs which are running in Production to a common user (Ex. BWGURU).  Presently the jobs are running on different users in SM37. My requirement is to schdule all the running / finished / scheduled /released / cancelled jobs to a common user. I am not manaage to schedule the finished / cancelled job.  How can i do that ?
    Please required ur inputs .
    thanks
    Praveen.

    Hi Praveen.....
    U can't never make a finished job to released............First a Job will be in Release state...........then it will be in Schedule.........then the Job will Start...........then either finish or Cancelled...........
    To start a job...............u hav ti to take the Released state of the Job to schedule......
    Hav u Clicked on immediate tab...........there just check the immediate box................then check and save...........
    U hav said.......i am getting extra job running with the same name............u mean that the job is is running State .............right.........Look u cannot create two jobs in same name...............may be that job is running.............hav u scheduled the job ?............may be thats why it is running..............if u want to cancel the running job.............double click on the job.............from job details copy the PID and Application server.............come out...........click on Application Server...............double click on the desired server...search the PID.and cancel the job.............
    Regards,
    Debjani..........

  • Scheduling a background job

    Hi all,
    I have a requirement in which i need to run a job only after 5th of everymonth to untill end of month in one hour gap.
    So it should be like that,job start from
    Nov---5th to nov 30th  then
    Dec---5th to Dex31th.How can  i acheive this?I cannot modify the program since it is a standard program?
    Apart from creating the customized program and call the standard program from there...i would like to have some other
    solution than this since there are variants in the standard program.
    Rgards,
    Arun.

    Hi Arun ,
    You can use Background Processing Event.
    An event is a signal stating that a predefined status in the system has
    been reached. The background processing system receives events and then
    starts the background job/jobs that is/are linked to an event.
    So in the "After Events" tab in SM36 you specify a perticular event which will be triggered on 5th of every month and you will schedule your job after that with periodicy as "every hour"
    Hope this will help to you .
    Regards,
    Nikhil

  • How to schedule a background job in realtime

    Hi,
    Can you tell me how to schedule a background job in realtime.
    give some example scenerios in scheduling the background jobs in realtime.
    Thanks.
    sam.

    And also.....
    There are two ways for you to handle,
    one manually setting up the job through SM36 which is better and convinient,
    secondly through program using FM's JOB_OPEN, SUBMIT, JOB_CLOSE.
    Find below steps in doing both:
    Procedure 1:
    1. Goto Trans -> SM36
    2. Define a job with the program and variant if any
    3. Click on start condition in application tool bar
    4. In the pop-up window, click on Date/Time
    5. Below you can see a check box "Periodic Job"
    6. Next click on Period Values
    7. Select "Other Period"
    8. Now give '15' for Minutes
    9. Save the job
    Procedure 2 via Program:
    Below is a sample code for the same. Note the ZTEMP2 is the program i am scheduling with 15mins frequency.
    DATA: P_JOBCNT LIKE TBTCJOB-JOBCOUNT,
    L_RELEASE(1) TYPE c.
    CALL FUNCTION 'JOB_OPEN'
    EXPORTING
    JOBNAME = 'ZTEMP2'
    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.
    SUBMIT ZTEMP2 VIA JOB 'ZTEMP2' NUMBER P_JOBCNT
    TO SAP-SPOOL WITHOUT SPOOL DYNPRO
    WITH DESTINATION = 'HPMISPRT'
    WITH IMMEDIATELY = SPACE
    WITH KEEP_IN_SPOOL = 'X' AND RETURN.
    CALL FUNCTION 'JOB_CLOSE'
    EXPORTING
    JOBCOUNT = P_JOBCNT
    JOBNAME = 'ZTEMP2'
    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.
    Hope the above helps you.
    ***********reward points,if found useful

  • Scheduling of Archive jobs

    Hi,
    i really need to apologize here, but i did not found an appropriate forum to ask this, neither a forum for ADK archiving development kit nor a forum about XBP (intercepted jobs). If there is a froum for asking questions like this you can slap me for that
    The archiving object is configured to schedule the ARVSTO jobs automatically which we want to keep to spread the load over a certain time and not to have a bunch of archiving jobs always running at a specific time.
    In this system we do not have a connection to a central job scheduling tool due to license costs.
    The problem is that sometimes ARVSTO jobs are scheduled exactly at the time where our IXOS serving is going down for 15 minutes for maintanence.
    I'm now looking for ANY possibility to avoid that ARVSTO jobs are scheduled between 4 and 5 o'clock. I hat a look at OSS notes 458670 and 604496, with those notes i can avoid that the jobs are starting automatically but i need an external job scheduler or i need to start them manually. I dont have a job scheduler and i dont want to do this manually.
    I had a look at report RSARCHD to do a modifaction but as far as i can see this one is only scheduling the ARVDEL jobs.
    So does anyone have an idea to solve this? Even if it is a modification, or en enhancement, a BADI or en exit, i dont care.
    Thanks in advance.

    Create one procedure and write all your logic which you want to schedure.
    Please execute the below block to set the job.
    Please change ### with Your PROCEDURE NAME WITH PARAMETER.
    'SYSDATE+1/1440' = Indicate that your job execute every minute..
    DECLARE
    X NUMBER;
    BEGIN
    SYS.DBMS_JOB.SUBMIT
    ( job => X
    ,what => '###'
    ,next_date => to_date('17/02/2010 12:54:32','dd/mm/yyyy hh24:mi:ss')
    ,interval => 'SYSDATE+1/1440 '
    ,no_parse => TRUE
    SYS.DBMS_OUTPUT.PUT_LINE('Job Number is: ' || to_char(x));
    END;
    commit;
    Edited by: user10594896 on Feb 16, 2010 11:28 PM

  • Scheduling an automatic Jobs in Data Services

    Dear Experts,
    could you please explain how to schedule an automatic job in Data Services?
    I would like to be able to schedule a daily, weekly or monthly job.
    Any Document which explain the steps?
    Thanks
    Pat

    I would not suggest doing anything on your production data. Make change in the job as given below. Add Map operation tranform just before where you are writing to the target table. Inside map operation transform select all to discard....make sure you have selected discard for every operation codes.  In order to see what data your job is tring to write to target table. Create a template table and then join that table to tranform which is just before map operation...i...suppose you have query transform at the end and then you write to target table. Then add this query transform to map operation transform as well as to template table.
    You can now get what data your job is going to write to target without writing anything to target.
    Test this in dev first before trying in Production.
    REMEMBER: PRODUCTION IS S SACRED SPACE AND WE DON"T WRITE UNNECESARY DATA OR DO ANY MANUPULATION IN PROD TABLES.
    Thanks,

  • Schedule "Nested" Recurring Job

    I am trying to schedule a job that will start running every Sunday evening and run every 5 minutes thereafter until early Monday morning. Without hardcoding the start and end dates, I can't get the start, end and repeat interval to work properly. I have also tried using a schedule outside the job.
    Any suggestions on how I might get this to work or where I can find a similar example?
    Thank you.
    DBMS_SCHEDULER.CREATE_JOB(
    job_name => 'FILE_WATCH_TEST_JOB'
    ,job_type => 'STORED_PROCEDURE'
    ,job_action => 'FILE_WATCH'
    ,number_of_arguments => 2
    ,start_date => TO_DATE('2008-05-25 19:55:00','YYYY-MM-DD HH24:MI:SS')
    ,end_date => TO_DATE('2008-05-26 06:55:00','YYYY-MM-DD HH24:MI:SS')
    ,repeat_interval => 'FREQ=MINUTELY;INTERVAL=5'
    ,enabled => FALSE
    ,comments => 'File Watch Test'
    );

    Hi,
    I think you may have to do this as two separate schedules and then create a combined schedule. Something like schedule s3 below would work.
    You may need to use a start_date (at a rounded minute value) or a byminute (and bysecond) clause if you want it to run exactly at 0,5,10 etc .
    Hope this helps,
    Ravi.
    BEGIN
      DBMS_SCHEDULER.create_schedule ('S1',repeat_interval =>
        'FREQ=MINUTELY;BYDAY=SUN;INTERVAL=5;BYHOUR=20,21,22,23');
      DBMS_SCHEDULER.create_schedule ('S2',repeat_interval =>
        'FREQ=MINUTELY;BYDAY=MON;INTERVAL=5;BYHOUR=0,1,2,3,4,5,6');
      DBMS_SCHEDULER.create_schedule ('S3', repeat_interval =>'s1, s2');
    END;
    create or replace procedure print_schedule_dates
       schedule in varchar2,
       start_date in timestamp with time zone default dbms_scheduler.stime(),
       number_of_dates in pls_integer default 10
    is
      date_after timestamp with time zone := start_date - interval '1' second;
      next_date timestamp with time zone;
    begin
      for i in 1 .. number_of_dates
      loop
        dbms_scheduler.evaluate_calendar_string
         (schedule, start_date, date_after, next_date);
        dbms_output.put_line(to_char(next_date,
                        'DY DD-MON-YYYY (DDD-IW) HH24:MI:SS TZH:TZM TZR'));
        date_after := next_date;
      end loop;
    end;
    exec print_schedule_dates('s3', number_of_dates => 150);

  • Schedule Time Evaluation Job

    Hi Experts,
    I have a requirment to schedule Time Evaluation Job Automatically at Every day 12:00 am midnight. Could you pls help how to create variants and schedule the job.
    Thanks
    Priya

    Hi, Priyadarshini.
        You can schedule a job also doing the following.
    1. Enter in transaction PT60.
    2. Define the parameters in the enter screen and save as variant.
    3. Go to menu: Program --> Execute in Background.
    4. Define the printer (so we can check the log error). Here use some printer already installed in sap and inform to send to SAP spooler, then you'll able to see the log in SP01.
    5. Click on the button "Date/Time";
    6. Inform the Date and the Time in "Schedule Start";
    7. Click on the button "Periodic job";
    8. Click on "Period values" and define Daily.
        And this is it. I think it's better you access the program like this to schedule the job, once in the Productive client, usually, we don't have access to the SE38.
    I hope it helps.
    Regards,
    Luciano.

  • How to schedule the back job scheduling

    how to schedule the back job for bdc , can we use it for both call transaction and session method . how to schedule the back job schedulinng for lsmw

    hi,
    Use t-code SM36 for scheduling.
    <b>Do reward.</b>

  • Schedule a daily job using JOB_CLOSE

    Hello,
    I want to schedule a daily job using job_open, job_submit & job_close.
    This job should run everyday at 22:00 hrs.
    What are the parameters I need to set for the FM JOB_CLOSE?
    Thanks,
    A Pothuneedi

    Look at this sample provided by SAP : <a href="http://help.sap.com/saphelp_sm32/helpdata/en/fa/096d8e543b11d1898e0000e8322d00/content.htm">Sample Program: Start-Time Window with JOB_CLOSE</a>
    Sample Program: Start-Time Window with JOB_CLOSE Locate the document in its SAP
    <b>Library structure</b>
    * Submit job: start-time window defined, with periodic repeat and
    * with target system upon which the job is to run.
    * In this case, you must provide start date settings. You can
    * have the job started immediately with a JOB_CLOSE parameter,
    * set the start date yourself, or ask the user with
    * BP_START_DATE_EDITOR.
    * Example: Provide start-date specifications yourself.
    STARTDATE = '19970101'.
    STARTTIME = '160000'.
    LASTSTARTDATE = '19970101'.
    LASTSTARTTIME = '180000'.
    CALL FUNCTION 'JOB_CLOSE'
    EXPORTING
    JOBCOUNT = JOBNUMBER " Job identification: number
    JOBNAME = JOBNAME " and name.
    SDLSTRTDT = STARTDATE " Start of start-time...
    SDLSTRTTM = STARTTIME " window
    LASTSTRTDT = LASTSTARTDATE " Optional: end of...
    LASTSTRTTM = LASTSTARTTIME " start-time window
    PRDMONTHS = '1' " Restart at intervals of
    PRDWEEKS = '1' " the sum of the PRD*
    PRDDAYS = '1' " parameters
    PRDHOURS = '1'
    PRDMINS = '1'
    STARTDATE_RESTRICTION = BTC_DONT_PROCESS_ON_HOLIDAY
    " Restrict job start to work
    " days; don't start job if
    " scheduled on holiday.
    " Other values:
    " BTC_PROCESS_BEFORE_HOLIDAY
    " BTC_PROCESS_AFTER_HOLIDAY
    CALENDAR_ID = '01' " ID of R/3 factory calendar
    " for determining workdays
    TARGETSYSTEM = 'hs0011' " Optional: name of the host
    " system on which the job is
    " to run. Set only if
    " absolutely required.
    " Example: A required tape
    " drive is accessible only
    " from a single host system.
    IMPORTING
    JOB_WAS_RELEASED = JOB_RELEASED " If user has authorization
    " to release jobs to run, job
    " is automatically released
    " when it is scheduled. This
    " field is set to 'x' if the
    " job has been released.
    " Otherwise, the job is sche-
    " duled but must be released
    " by an administrator before
    " it can be started.
    EXCEPTIONS
    INVALID_STARTDATE = 01
    JOBNAME_MISSING = 02
    JOB_CLOSE_FAILED = 03
    JOB_NOSTEPS = 04
    JOB_NOTEX = 05
    LOCK_FAILED = 06
    OTHERS = 99.
    IF SY-SUBRC > 0.
    <Error processing>
    ENDIF.
    Regards

  • Scheduling a background job depending on the output lenght.

    Hi every one,
    I have a small requirement. My client want me to run a program in a foreground if the output is small and should the program in background if the output is large.This has to be achieved through coding. The program downloads the netprices of products. The downloaded file is of .dat format. It is an urgent requirement.
    Guys you would throughly rewarded for your help.
    Thanks,
    Kumar.9886185040.

    Hi Nag
    that is not possible with codeing. To create a schedule a background job for the same program depending on its output is not possible.
    being a programmer you need to decide, how long the code will take to execute.. accordingly you can either schedule or run in foreground. You can make some mandatory fields in the selection screen, so that the output is big mostly.
    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.
    Regards
    JJ

Maybe you are looking for

  • June 2009 affordable HD camcorder suggestions please

    Hi Need to buy an 'affordable' (student budget) HD camcorder to get me going. What suggestions today - 18th June 2009 - and why? Many thanks SC

  • Scroll question

    Hi! How can I make to possible scrolling with the mouse wheel the embedded flash site? If the mouse is over the flash the mouse wheel doesn't work, but on the sides where flash isn't, the scroll is working. Or is there a command, which control the mo

  • Reading Mails in JavaMail API

    Hi, i need to read my inbox from my gmail account. i have given the following configuration parameters in my program inside a hashtable. Hashtable hashObj = new Hashtable(); hashObj.put("host","pop.gmail.com"); hashObj.put("user","[email protected]")

  • Cannot set DbSl trace function

    Hi, The license of EP is expired and I tried to install new license using saplicense -install. I got error message below: SAPLICENSE (Release 700) ERROR ***     ERROR:   Can not set DbSl trace function     DETAILS: DbSlControl(DBSL_CMD_IMP_FUNS_SET)

  • Problem installing Flash Professional CS6

    Hi, Would you be able to advise. At present I`m looking into building a network deployment of windows version CS6,  that we can install on our teaching machines here next year. It`s the Design and Web premium version that we'll be making available. E