Wednesday, April 5, 2017

Scheduling background jobs

By Rahul Tyagi


Objective: Scheduling a background job in SAP R/3. These document intents to provide steps which can be done even by an end user to prepare a Job.  
Main Steps:
1.     Change screen layout of stock report as per the requirement.
2.     Create variant to run the stock report (MB52) via Job.
3.     Access transaction code SM36 (Job creattion) to create the Job.
4.     Monitor the Job and check the spool by SM37 (Job overview)
5.     Access SAP Business Work place to check the Spool.


Step1: Create Screen layout
Assumption: Go to transaction MB52 and enter the value of the Plant (let’s say 1000).   


Step 2: Create Variant along with the layout which we have created in previous step.
Press F4 on the layout field in initial screen and then press save.  
After selecting the layout here please click on save.  


Step 3: Please mention the variant name as per your choice and also mention the description.
You may also mark the check-box protect variant for the field plant and layout though it’s not mandatory.
Save  


Step 4: Finding the program name for transaction code MB52  
Now please notice the Program name RM07MLBS.  


Step 5: Log in transaction code SM36.
Mention the Job name as ZDaliystk_MB52_1000.  

Press enter to get the below screen  


Click on the ABAP program and mention the program and also select the variant name which was created in initial steps.  


 

Click on check and save  


Step 6: Now click on the start condition button.
In this step we are giving the frequency of running the job. As already mentioned the Job needs to run daily basis.  
click on the period values button  and also mark the period check box as the job has to run every day.
Click on the spool recipient button  
Just press enter and save to get the message that job is in release status  
Monitor and check the output of job. Access transaction code SM37.
Also mention the Job name  
 
execute and check the spool.  
click on the type  


Step 7: Here we are with the results which is list of stock in our case


  • You can find the information relating to scheduling at these below tables.
E.g. In order to get the schedule period of a program, we can do as following:

TCPCP-PROGNAME to get the Jobname and Jobcount.
Then use the jobname, jobcount to get the schedule period in the table TBTCS.

Background Job Scheduling Tables:
TBTCS (Background Processing: Time Schedule Table):

FieldData ElementData Typelength (Decimals)ChecktableDescription
JOBNAMEBTCJOBCHAR32Background job name
JOBCOUNTBTCJOBCNTCHAR8Job ID
BTCSYSTEMBTCTGTSYSCHAR32Target System to Run Background Job
JOBGROUPBTCJOBGRPCHAR12Summary of jobs for a group
INTREPORTBTCREPCHAR40Name of internal report for batch job
SDLSTRTDTBTCSDATEDATS8Planned Start Date for Background Job
SDLSTRTTMBTCSTIMETIMS6Planned start time for background Job
PRDMINSBTCPMINNUMC2Duration period (in minutes) for a batch job
PRDHOURSBTCPHOURNUMC2Duration period (in hours) for a batch job
PRDDAYSBTCPDAYNUMC3Duration (in days) of DBA action
PRDWEEKSBTCPWEEKNUMC2Duration period (in weeks) for a batch job
PRDMONTHSBTCPMNTHNUMC2Duration period (in months) for a batch job
PERIODICBTCPFLAGCHAR1Periodic Jobs Indicator
DELANFREPBTCDELFLAGCHAR1Job deletion indicator after processing
EMERGMODEBTCEFLAGCHAR1Emergency Job operation indicator (content 'X')
SDLUNAMEBTCSDLNMCHAR12Initiator of job/step scheduling
AUTHCKNAMBTCAUTHNAMCHAR12Background User Name for Authorization Check
AUTHCKMANBTCAUTHMANCLNT3
*
Background client for authorization check
SUCCNUMBTCSNUMINT410Number of successor job(s)
EOMCORRECTBTCEOMCORRINT410Correction field for calc. job execution (end-of-mth, cal.)
JOBCLASSBTCJOBCLASCHAR1Job classification
PRIORITYBTCJOBPRIOINT410Job priority
EXECSERVERBTCSRVNAMECHAR20Server name
CALCORRECTBTCEOMCORRINT410Correction field for calc. job execution (end-of-mth, cal.)
TGTSRVGRPBPSRVGRPNCHAR40Server Group Name Background Processing


TBTCP (Background Job Step Overview Table)

FieldData ElementData Typelength (Decimals)ChecktableDescription
JOBNAMEBTCJOBCHAR32Background job name
JOBCOUNTBTCJOBCNTCHAR8Job ID
STEPCOUNTBTCSTEPCNTINT410Job step ID number.
PROGNAMEBTCPROGCHAR40Program name within a step (e.g. report)
PROGFROMLNBTCSRCLINEINT410Line number in an internal report.
PROGTOLNBTCSRCLINEINT410Line number in an internal report.
SDLDATEBTCSDLDATEDATS8Date of job/step scheduling
SDLTIMEBTCSDLTIMETIMS6Time of a scheduled job/step
SDLUNAMEBTCSDLNMCHAR12Initiator of job/step scheduling
VARIANTBTCVARIANTCHAR14Name of variant within a step
AUTHCKNAMBTCAUTHNAMCHAR12Background User Name for Authorization Check
LISTIDENTBTCLISTIDNUMC10ID of batch job output list in the spool
XPGPIDBTCXPGPIDCHAR10ID of external program
XPGTGTSYSBTCTGTSYSCHAR32Target System to Run Background Job
XPGRFCDESTRFCDESTCHAR32
*
Logical Destination (Specified in Function Call)
XPGPROGBTCXPGPGMCHAR128Name of external program (possibly with access path)
XPGPARAMSBTCXPGPARCHAR255Parameters of external program (string)
XPGFLAGBTCSTEPTYPCHAR1Identification of step as ABAP, ext. command or program
CONNCNTLBTCXPGCNTLCHAR1Control flag for external program (e.g. trace level)
STDINCNTLBTCXPGCNTLCHAR1Control flag for external program (e.g. trace level)
STDOUTCNTLBTCXPGCNTLCHAR1Control flag for external program (e.g. trace level)
STDERRCNTLBTCXPGCNTLCHAR1Control flag for external program (e.g. trace level)
TRACECNTLBTCXPGCNTLCHAR1Control flag for external program (e.g. trace level)
TERMCNTLBTCXPGCNTLCHAR1Control flag for external program (e.g. trace level)
STATUSBTCPSTATUSCHAR1Status of step in background processing
EXITCODEBTCXPGEXITINT410Exit code of an external program
LANGUAGESPRASLANG1
*
Language Key
EXTCMDSXPGLOGCMDCHAR18Logical command name
OPSYSTEMSYOPSYSCHAR10Operating System of Application Server
.INCLUDEPRI_PAROLDStructure for passing print parameters
PDESTSYPDESTCHAR4
*
Spool Output Device
PRCOPSYPRCOPNUMC3Number of Spool Copies
PLISTSYPLISTCHAR12Spool Request
PRTXTSYPRTXTCHAR68Spool Description
PRIMMSYPRIMMCHAR1Immediate Spool Print
PRRELSYPRRELCHAR1Immediate Spool Deletion
PRNEWSYPRNEWCHAR1New Spool Request
PEXPISYPEXPINUMC1Spool Retention Period
LINCTSYLINCTINT410Page Length of List
LINSZSYLINSZINT410Line width of list
PAARTSYPAARTCHAR16
*
Spool Format
PRBIGSYPRBIGCHAR1Spool Cover Sheet
PRSAPSYPRSAPCHAR1Print: SAP cover page
PRRECSYPRRECCHAR12Spool Recipient Name
PRABTSYPRABTCHAR12Spool Department Name
PRBERSYPRBERCHAR12Print: Authorization
PRDSNSYPRDSNCHAR6Spool File
PTYPESYPTYPECHAR12Print: Type of spool request
ARMODSYARMODCHAR1Print: Archiving mode
FOOTLSYFOOTLCHAR1Print: Output footer
PRCHKSYCHECKINT410Print: Check sum for print and archiving parameters
.INCLUDEARC_PARAMSStructure of Transfer from Archiving Parameters
SAP_OBJECTSYARC_SAP_OBJECTCHAR10
*
Archiving Parameter: Object Type of SAP Object
AR_OBJECTSYARC_AR_OBJECTCHAR10
*
Archiving Parameter: Document Type
ARCHIV_IDSYARC_ARCHIV_IDCHAR2Archiving Parameter: Target Storage System
DOC_TYPESYARC_DOC_TYPECHAR20
*
Archiving Parameter: Document Type
RPC_HOSTSYARC_RPC_HOSTCHAR32Archiving Parameter: RPC Host
RPC_SERVICSYARC_RPC_SERVICCHAR32Archiving Parameter: RPC Service/RFC Destination
INTERFACESYARC_INTERFACECHAR14Archiving Parameter: Communication Connection Component
MANDANTSYARC_MANDANTCLNT3
*
Archiving Parameter: Client
REPORTSYARC_REPORTCHAR40
*
Archiving Parameter: Program Name
INFOSYARC_INFOCHAR3Archiving Parameter: Info Field
ARCTEXTSYARC_ARCTEXTCHAR40Archiving Parameter: Text Information Field
DATUMSYARC_DATUMCHAR8Archiving Parameter: Archiving Date
ARCUSERSYARC_ARCUSERCHAR12Archiving Parameter: User
PRINTERSYARC_PRINTERCHAR4
*
Archiving Parameter: Target Output Device
FORMULARSYARC_FORMULARCHAR16Archiving Parameter: Output Format
ARCHIVPATHSYARC_ARCHIVPATHCHAR70Archiving Parameter: Standard Path
PROTOKOLLSYARC_PROTOKOLLCHAR8Archiving Parameter: Log
VERSIONSYARC_VERSIONCHAR4Archiving Parameter: Version Number
ACHECKSYARC_CHECKINT410Archiving Parameter: Check Total
PRIPARKEYSYPRKEYCHAR16Key for print parameters
CONVIDGWY_CONVIDCHAR8Conversation ID


TBTCO (Job Status Overview Table)

FieldData ElementData Typelength (Decimals)ChecktableDescription
JOBNAMEBTCJOBCHAR32Background job name
JOBCOUNTBTCJOBCNTCHAR8Job ID
JOBGROUPBTCJOBGRPCHAR12Summary of jobs for a group
INTREPORTBTCREPCHAR40Name of internal report for batch job
STEPCOUNTBTCSTEPCNTINT410Job step ID number.
SDLSTRTDTBTCSDATEDATS8Planned Start Date for Background Job
SDLSTRTTMBTCSTIMETIMS6Planned start time for background Job
BTCSYSTEMBTCTGTSYSCHAR32Target System to Run Background Job
SDLDATEBTCSDLDATEDATS8Date of job/step scheduling
SDLTIMEBTCSDLTIMETIMS6Time of a scheduled job/step
SDLUNAMEBTCSDLNMCHAR12Initiator of job/step scheduling
LASTCHDATEBTCJCHDATEDATS8Date of last job change
LASTCHTIMEBTCJCHTIMETIMS6Time of last job change
LASTCHNAMEBTCJCHNMCHAR12Last job change made by
RELDATEBTCRELDTDATS8Release Date for Background Scheduling
RELTIMEBTCRELTMTIMS6Release time of scheduled background job
RELUNAMEBTCRELNMCHAR12User that released scheduled batch job
STRTDATEBTCXDATEDATS8Job start date
STRTTIMEBTCXTIMETIMS6Batch job start time
ENDDATEBTCXDATEDATS8Job start date
ENDTIMEBTCXTIMETIMS6Batch job start time
PRDMINSBTCPMINNUMC2Duration period (in minutes) for a batch job
PRDHOURSBTCPHOURNUMC2Duration period (in hours) for a batch job
PRDDAYSBTCPDAYNUMC3Duration (in days) of DBA action
PRDWEEKSBTCPWEEKNUMC2Duration period (in weeks) for a batch job
PRDMONTHSBTCPMNTHNUMC2Duration period (in months) for a batch job
PERIODICBTCPFLAGCHAR1Periodic Jobs Indicator
DELANFREPBTCDELFLAGCHAR1Job deletion indicator after processing
EMERGMODEBTCEFLAGCHAR1Emergency Job operation indicator (content 'X')
STATUSBTCSTATUSCHAR1State of Background Job
S: Scheduled
R: Released
A: Active
F: Finished
C: Canceled
NEWFLAGBTCNEWFLAGCHAR1New job ID creation flag
AUTHCKNAMBTCAUTHNAMCHAR12Background User Name for Authorization Check
AUTHCKMANBTCAUTHMANCLNT3
*
Background client for authorization check
SUCCNUMBTCSNUMINT410Number of successor job(s)
PREDNUMBTCPNUMINT410Number of previous jobs
JOBLOGRSTSONAMECHAR20TemSe object name
LASTSTRTDTBTCLSDATEDATS8Latest Execution Date for a Background Job
LASTSTRTTMBTCLSTIMETIMS6Latest Execution Time for Background Job
WPNUMBERBTCWPNOINT410Work process number
WPPROCIDBTCWPPIDINT410Work process ID
EVENTIDBTCEVENTIDCHAR32Background Processing Event
EVENTPARMBTCEVTPARMCHAR64Background Event Parameters (Such as, Jobname/Jobcount)
BTCSYSREAXBTCTGTSYSCHAR32Target System to Run Background Job
JOBCLASSBTCJOBCLASCHAR1Job classification
PRIORITYBTCJOBPRIOINT410Job priority
EVENTCOUNTBTCEVTCNTCHAR8Event number
CHECKSTATBTCCKSTATCHAR1Job status check indicator for subsequent job start
CALENDARIDBTCCALIDCHAR2Factory Calendar ID for Background Processing
PRDBEHAVBTCPRDBHVCHAR1Period behavior of jobs on non-workdays
EXECSERVERBTCSRVNAMECHAR20Server name
EOMCORRECTBTCEOMCORRINT410Correction field for calc. job execution (end-of-mth, cal.)
CALCORRECTBTCEOMCORRINT410Correction field for calc. job execution (end-of-mth, cal.)
REAXSERVERBTCSRVNAMECHAR20Server name
RECLOGSYSLOGSYSCHAR10
*
Logical system
RECOBJTYPESWO_OBJTYPCHAR10
*
Object Type
RECOBJKEYSWO_TYPEIDCHAR70Object key
RECDESCRIBSWO_DESCRBCHAR10Describe flag
TGTSRVGRPBPSRVGRPNCHAR40Server Group Name Background Processing

No comments:

Post a Comment

SAP giới thiệu mã hỗ trợ AI trong ngôn ngữ ABAP riêng của mình

SAP đã ra mắt một loạt tính năng mã hỗ trợ AI trong môi trường phát triển ứng dụng dựa trên đám mây của mình, đồng thời tham gia vào danh sá...