https://sapfidocz.wordpress.com/wp-content/uploads/2013/01/automatec-period-opening-in-sap.pdf
sm36에서 배치잡 만들고
sm37에서 배치 현황 볼 수 있다.
" Job Open
DATA : lv_jobname LIKE TBTCJOB-JOBNAME,
LV_JOBCOUNT LIKE TBTCJOB-JOBCOUNT.
lv_jobname = 'ZBAMI_RVSETDAT'.
call FUNCTION 'JOB_OPEN'
EXPORTING
* delanfrep = space
* jobgroup = space
jobname = lv_jobname " SM36에서 만든 Job Name 기입.
* sdlstrtdt = NO_DATE
* sdlstrttm = NO_TIME
* jobclass =
* check_jobclass =
IMPORTING
jobcount = lv_jobcount
* info =
* CHANGING
* ret =
* 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 " 수행 User
* commandname = space
* operatingsystem = space
* extpgm_name = space
* extpgm_param = space
* extpgm_set_trace_on = space
* extpgm_stderr_in_joblog = 'X'
* extpgm_stdout_in_joblog = 'X'
* extpgm_system = space
* extpgm_rfcdest = space
* extpgm_wait_for_termination = 'X'
jobcount = lv_jobcount
jobname = lv_jobname
* language = SY-LANGU
* priparams = space
report = SY-REPID " 해당 프로그램.
* variant = space
* 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
* at_opmode = space
* at_opmode_periodic = space
* calendar_id = space
* event_id = space
* event_param = space
* event_periodic = space
jobcount = lv_jobcount
jobname = lv_jobname
* laststrtdt = NO_DATE
* laststrttm = NO_TIME
* prddays = 0
* prdhours = 0
* prdmins = 0
* prdmonths = 0
* prdweeks = 0
* predjob_checkstat = space
* pred_jobcount = space
* pred_jobname = space
* sdlstrtdt = NO_DATE
* sdlstrttm = NO_TIME
* startdate_restriction = BTC_PROCESS_ALWAYS
strtimmed = 'X' " 즉시 실행 여부
* targetsystem = space
* start_on_workday_not_before = SY-DATUM
* start_on_workday_nr = 0
* workday_count_direction = 0
* recipient_obj =
* targetserver = space
* dont_release = space
* targetgroup = space
* direct_start =
* inherit_recipient =
* inherit_target =
* register_child = abap_false
* time_zone =
* email_notification =
* IMPORTING
* job_was_released =
* CHANGING
* ret =
* 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
* invalid_time_zone = 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.