SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

Job planning in Background



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Batch Input (BDC), Background processing and Jobs
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1640

PostPosted: Sat Sep 22, 2007 7:56 pm    Post subject: Job planning in Background Reply with quote

Code:
DATA: l_jobnumber LIKE v_jobnumber1.
DATA: l_jobname LIKE v_jobname1.

CLEAR : l_jobnumber.
l_jobname = 'JOB1'.

CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = l_jobname
IMPORTING
jobcount = l_jobnumber
EXCEPTIONS
cant_create_job = 01
invalid_job_data = 02
jobname_missing = 03
OTHERS = 99.

IF sy-subrc NE 0.
MESSAGE s368(00) WITH 'Error Creating Job'
sy-subrc.
EXIT.
ENDIF.

******
* Add a job step 01: ABAP program
*
******
CLEAR: v_valid, s_pri_params, s_arc_params.


* Create the job step.
CALL FUNCTION 'JOB_SUBMIT'
EXPORTING
authcknam = sy-uname " Runtime auth user
jobcount = l_jobnumber "
jobname = l_jobname "
REPORT = V_REPID " Report to be run
VARIANT = V_VARIANT " Report Variant
PRIPARAMS = S_PRI_PARAMS "Usr print opt
ARCPARAMS = S_ARC_PARAMS "Usr archiving opt
EXCEPTIONS
bad_priparams = 01
invalid_jobdata = 02
jobname_missing = 03
job_notex = 04
job_submit_failed = 05
lock_failed = 06
program_missing = 07
prog_abap_and_extpg_set = 08
OTHERS = 99.

IF sy-subrc > 0.
MESSAGE s398(00) WITH 'Unable to Submit Job Step'
v_repid
sy-subrc.
STOP.
ELSE.
* MESSAGE s398(00) WITH 'Job Step Created'
* v_repid.
ENDIF.

* Submit job
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = l_jobnumber "
jobname = l_jobname "
strtimmed = 'X' " Immediate
targetsystem = k_tgt_system
targetserver = k_tgt_server
IMPORTING
job_was_released = v_job_released "Status
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.
MESSAGE s368(00) WITH 'Job not closed'
sy-subrc.
EXIT.
ENDIF.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Batch Input (BDC), Background processing and Jobs All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.