Application Development and Automation 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: 
Read only

JOB Scheduling

Former Member
0 Likes
937

Hi All

How to schedule job with two programs i.e. second program should run immediatly after the first program.

Thanks

srini

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
901

hi girinadha reddy

need more clarification.

you pass any data from program 1 to program 2 ?

if you are passing means try to call the program 2 in the program 1 itself ...

Regards

Deva

Hi All

How to schedule job with two programs i.e. second program should run immediatly after the first program.

Thanks

srini

6 REPLIES 6
Read only

Former Member
0 Likes
901

Hi

Go to SM36..U arrange ur jobs.

Regards:

Prabu

Read only

Former Member
0 Likes
902

hi girinadha reddy

need more clarification.

you pass any data from program 1 to program 2 ?

if you are passing means try to call the program 2 in the program 1 itself ...

Regards

Deva

Read only

Former Member
0 Likes
901

go to sm36

in that click on extended job selection

in that start condition one option is available

start after job

u can use that

and i think it iwll be helpful for you

Read only

Former Member
0 Likes
901

Hi,

Add the two programs in to the Job one after the another it will execute in sequence.ie one after the another.

Also you can use Event triggering ,wish you want to wait till a particular event is raised and then the job is submitted.(embed the second program in to this job).

Hope this helps.

Harry

Edited by: Harpreet Singh on Aug 27, 2008 8:02 AM

Read only

former_member745780
Active Participant
0 Likes
901

Hello

stpes for JOB Scheduling

1. Call transaction SM36.

2. Give a job name.

3. Set the job?s priority, ie. High, Medium or Low priority.

4. Define when the job is to start by choosing Start Condition and completing the appropriate selections. If the job is to repeat, or be periodic, check the box at the bottom of this screen.

5. Define the job?s steps by choosing Step, then specify the ABAP program to be used for each step.

6. Save the fully defined job to submit it to the background processing system.

7. Release the job.

check this

http://help.sap.com/saphelp_nw04/helpdata/en/ef/2c513897110872e10000009b38f889/frameset.htm

Thanks

Read only

Former Member
0 Likes
901

Hi Giridhar

--> In side the first program use the following F.M's two process the second program

JOB_OPEN

JOB_SUBMIT

JOB_CLOSE

Also Use RS_CREATE_VARIANT (To create the variant)

the below is the test program

&----


*& Report ZTEST_BG_JOB

*&

&----


*&

*&

&----


REPORT ztest_bg_job.

----


*INTERNAL TABLE DECLARATIONS *

----


TYPES : BEGIN OF ty_postp_value,

postp TYPE postp,

END OF ty_postp_value.

TYPE-POOLS : cobai.

DATA : t_zbcparm TYPE STANDARD TABLE OF zbcparm,

t_seltab TYPE STANDARD TABLE OF rsparams.

----


*WORK AREA DECLARATIONS *

----


DATA : gs_zbcparm TYPE zbcparm,

gs_header TYPE LINE OF cobai_t_header,

gs_component TYPE LINE OF cobai_t_component,

gs_seltab TYPE rsparams.

----


*VARIABLE DECLARATIONS *

----


DATA : l_zvalue_postp TYPE zbcparm-zvalue, "Item catagory

l_zvalue_gihor TYPE i, "Cut off date from ZBCPARM

l_cutoff_date TYPE sy-datum, "Cut off date as SY-DATUM

l_flag_gi(1) TYPE c, "Flag

l_fabkl TYPE t001w-fabkl, "Factory calendar key

l_return TYPE sy-subrc, "Return value

l_length TYPE i,

l_length1 TYPE i,

l_lines TYPE i,

l_set TYPE match_result-offset,

l_set2 TYPE match_result-offset,

l_zvalue TYPE zbcparm-zvalue,

l_uzeit LIKE sy-uzeit,

l_uzeit1 LIKE sy-uzeit,

l_datum TYPE tbtcjob-sdlstrtdt,

l_time TYPE tbtcjob-sdlstrttm,

l_uzeit2 LIKE sy-uzeit VALUE 300.

DATA: t_postp TYPE match_result_tab,

t_postp_value TYPE STANDARD TABLE OF ty_postp_value,

gs_postp TYPE LINE OF match_result_tab,

gs_postp_value TYPE ty_postp_value.

DATA: number TYPE tbtcjob-jobcount,

name TYPE tbtcjob-jobname VALUE 'ZJOB_TEST',

print_parameters TYPE pri_params.

DATA: csm_std_reconciler TYPE rsvar-report VALUE 'ZSCM_GOODS_ISSUE_BATCH_DETRM',

csmvari TYPE rsvar-variant,

csmvarid TYPE varid,

varitext TYPE STANDARD TABLE OF varit,

ts TYPE timestamp.

----


*CONSTANTS DECLARATIONS *

----


CONSTANTS : c_auart(5) TYPE c VALUE 'AUART', "Order type

c_postp(5) TYPE c VALUE 'POSTP', "Item cataogory

c_gihorizon(6) TYPE c VALUE 'ZGIHOR', "Cut off date

c_program_id TYPE zbcparm-zprogram_id VALUE 'ZSCM_RETRIEVE_STOCKS'.

"Program ID

*POPULATE T_SELTAB with data required to submit to program

*4009259

*4009260

CLEAR gs_seltab.

gs_seltab-selname = 'P_WERKS'.

gs_seltab-kind = 'P'.

gs_seltab-low = 'YUL1' ."gs_header-werks.

gs_seltab-sign = 'I'.

gs_seltab-option = 'EQ'.

APPEND gs_seltab TO t_seltab.

gs_seltab-selname = 'S_AUFNR'.

gs_seltab-kind = 'S'.

gs_seltab-low = '4009259'. "gs_header-aufnr.

gs_seltab-sign = 'I'.

gs_seltab-option = 'EQ'.

APPEND gs_seltab TO t_seltab.

l_uzeit = sy-uzeit.

l_uzeit1 = l_uzeit + l_uzeit2.

l_datum = sy-datum.

l_time = l_uzeit1.

*************************************************************

GET TIME STAMP FIELD ts.

csmvari = ts.

CLEAR csmvarid.

csmvarid-mandt = sy-mandt.

csmvarid-report = csm_std_reconciler." program name

csmvarid-variant = csmvari.

csmvarid-ename = sy-uname.

csmvarid-edat = sy-datum.

csmvarid-etime = sy-uzeit.

CALL FUNCTION 'RS_CREATE_VARIANT'

EXPORTING

curr_report = csm_std_reconciler " program name

curr_variant = csmvari

vari_desc = csmvarid

TABLES

vari_contents = t_seltab

vari_text = varitext

  • VSCREENS =

EXCEPTIONS

illegal_report_or_variant = 1

illegal_variantname = 2

not_authorized = 3

not_executed = 4

report_not_existent = 5

report_not_supplied = 6

variant_exists = 7

variant_locked = 8

OTHERS = 9.

IF sy-subrc <> 0.

  • MESSAGE ID 'CSM' TYPE 'W' NUMBER '045' WITH csm_std_reconciliation_job.

EXIT.

ENDIF.

************************************************************

CALL FUNCTION 'JOB_OPEN'

EXPORTING

jobname = name

  • SDLSTRTDT = l_datum

  • SDLSTRTTM = l_time

IMPORTING

jobcount = number

EXCEPTIONS

cant_create_job = 1

invalid_job_data = 2

jobname_missing = 3

OTHERS = 4.

IF sy-subrc = 0.

*****************************************

CALL FUNCTION 'JOB_SUBMIT' IN BACKGROUND TASK

EXPORTING

  • ARCPARAMS =

authcknam = sy-uname

jobcount = number

jobname = name

report = csm_std_reconciler

variant = csmvari

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 'CSM' TYPE 'W' NUMBER '045' WITH csm_std_repository_job.

EXIT.

ENDIF.

*****************************************

  • IF sy-subrc = 0.

CALL FUNCTION 'JOB_CLOSE'

EXPORTING

jobcount = number

jobname = name

sdlstrtdt = l_datum

sdlstrttm = l_time

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

IF sy-subrc <> 0.

*--- Do nothing

ENDIF.

  • ENDIF.

ENDIF.

Hope this will helps you

Thanks& Regards

Mallikharjuna Reddy