Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

backgroung\d scheduling

Former Member
0 Kudos
150

hi in sm35 while defining hte stpes to schedule a program

is it necesary to give the variant name for a program??

cant we just give the program name?

1 ACCEPTED SOLUTION

Former Member
0 Kudos
128

Hi Ashish,

Yes you can give just the program name.

Regards,

Atish

7 REPLIES 7

Former Member
0 Kudos
129

Hi Ashish,

Yes you can give just the program name.

Regards,

Atish

Former Member
0 Kudos
128

HI,

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

In SM37 u can check the status of the jobs that u have assigned to background...

Here u mention the job name or the report name to check the status of the job...

After mentioning the job name or program name u just execute it.. ( without any name also u can execute then it gives u all the jobs set by your user name..

the status colud be released,active,finished etc..

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.

Kind Regards

Reshma

Former Member
0 Kudos
128

Hi

In SM36 Tcode

create a Job and press the STEP on menu and there you have to give the Program name and variant name(if it is there) and then define the other paramters like time etc

Create a Variant for the Program and

Schedule JOB in background:

Go to SM36 create a Job

click on Start Condition

Click on DATE and TIME enter date scheduled Start and END times

click on Period Values

Click on HOURLY/WEEKLY etc

CLick on RESTRICTIONS also to use further criteria.

so your job will be scheduled and run as per your requirement.

and in SM37 Transaction check the status of that JOB

Check this link for scheduling jobs..

http://help.sap.com/saphelp_nw2004s/helpdata/en/c4/3a7f87505211d189550000e829fbbd/content.htm

<b>Reward points for useful Answers</b>

Regards

Anji

0 Kudos
128

hi anji

how r u

i have deone all the steps have checked all the things

but the problem is that in status it is howing finished

but the program that i have is creating a flat file on the server without giving any parameter you jkust have to execute it and the flat file while be created

even after the status is hsowing finished

it is not creating the flat file

i kow its a bit strange

but its happening

0 Kudos
128

Hi Ashish,

I think you asked this question in another thread also.

Please check that thread.

Regards,

Atish

Former Member
0 Kudos
128

see this link.

Former Member
0 Kudos
128

thnx a lot for ur help