ABAP Job Management
Your Automic System provides various ways that support processing in SAP. You can execute jobs predefined in SAP or run reports that are ABAP executable programs. You can run external commands or programs, intercepted jobs, etc. You use specific SAP Job objects and sub-jobs for this purpose. You can also analyze application return codes of SAP steps.
This page includes the following:
Executing Jobs in ABAP Stack (CCMS)
In the Process pages of SAP Job objects, you can define statements that are then processed in the SAP system. The Forms view of an SAP Job object provides a graphical interface connected to the SAP system. This interface allows you to select data such as variants directly.
You can also use the RemoteTaskManager object type to monitor and start jobs in SAP. This object type is beneficial for intercepted jobs. See Remote Task Manager (JOBQ)
The Process Monitoring perspective informs you about task states, including their child processes. If necessary, you can restart or cancel tasks. When a task has ended in the Automic System, you can access its report, including SAP system messages. See Reports
AE JCL for SAP
The following script elements are available:
-
Executes an external command
-
Executes an external program
-
Executes intercepted jobs under control
-
Executes jobs that are scheduled in SAP under the control of the AE
-
Executes the specified report
-
Selects SAP jobs and lists the result in the activation report or in a file
-
Modifies an ABAP step
-
Resets a released SAP job to the status Planned
See also Example: Creating an SAP ABAP Job from within the AE
Child Processes (JOBD)
SAP jobs can consist of one or several sub-jobs (child processes), for example, in process chains. The AWI can show these child processes in its Process Monitoring perspective. All SAP jobs have a specific Child Process Page. This page is processed when an individual child process ends, which allows you to analyze results immediately.
Important!
-
You can activate the parent-child function in the SE38 transaction by using the INITXBP2 program.
-
The object type of child processes is JOBD.
-
Set the parameter REPLICATE=YES in the relevant script elements to have the child processes replicated in your Automic System.
-
Child processes can also have child processes. You can see them in the Parent column.
-
The Status text field in the Detail pane of child processes shows the name of the SAP job, and the Process ID field shows the SAP job count. With this information, you can find this job in SAP.
-
You can deactivate child processes in the corresponding parent processes.
Your Automic System creates lists of task executions and reports for each child process. You can open them through the particular Executions lists. See Execution Data
Children's reports are structured in the same way as the report of their top parent process. The only exception is that they contain only information about the particular process step. The job report settings (database, file, or on error only) are passed on from the top parent process. You can define the report length with the parameters JOBLOG=, PROCESSLOG=, and LONGTEXT= of the BW_ACTIVATE_CHAIN and BW_RESTART_CHAIN script elements. See also Reports
AE JCL for SAP
The following script elements are available:Your
-
Starts a process chain
-
Continues an aborted process chain
-
Executes intercepted jobs under AE control
-
Executes jobs that are scheduled in SAP under the control of the AE
-
Executes the specified report
Intercepted Jobs
SAP jobs include a TBCICPT1 table where you can define filter criteria. You can access this table and can maintain its entries through the Form view on the Process page of SAP jobs (XBP 2.0). Use the INITXBP2 program to activate the intercept function in the SE38 transaction. Alternatively, you can use the Criteria Manager (XBP3.0) on the Process page to define complex filters in one or multiple profiles. Use the SM62 transaction in this case.
Filter criteria can include a client, a job name, or a user. If a user, who is defined in this table starts a job that meets the specified filter criteria, the status of the job changes to a scheduled status. This status change happens regardless of its defined start mode (Immediately, for example).
To execute intercepted jobs, you can either
- Use the Remote Task Manager to control and monitor intercepted jobs. See Defining Remote Task Manager Objects
- Use the R3_ACTIVATE_INTERCEPTED_JOBS script element described below
AE JCL for SAP
The following script elements are available to run or modify intercepted jobs:
-
Executes intercepted jobs under AE control
-
Reads the filter table for intercepted jobs and stores it in the activation log or a file
-
Modifies the filter table of intercepted jobs. Use it to change table entries dynamically.
Evaluating the Application Return Code of SAP Steps
An SAP job step can have an application return code. You can access this code either through the R3_GET_APPLICATION_RC script element or through a step list report which includes information about the steps plus the application return code. You can also access the application return code through the Job report.
Important! If you use the XBP interface, there is no application return code.
Access through a Script Element
You can use the R3_GET_APPLICATION_RC script element to check the application return code of one or several job steps. If necessary, you can cancel the AE job. For more information, see R3_GET_APPLICATION_RC.
Access through the Step List Report
This specific report type contains information about the steps plus the application return code. Use XML script elements to read the return code. For more information, see Script Functions for XML Elements and Special Reports for SAP Jobs
Example
:SET &xmlreport# = XML_OPEN(REPORT,,SSTP)
! Reading the first element
:SET &job# = XML_GET_FIRST_CHILD(&xmlreport#)
:SET &name# = XML_GET_NODE_NAME(&job#)
:PRINT "First element: &name#"
! Reading the second element
:SET &child# = XML_GET_FIRST_CHILD(&step#)
! Reading the step's children
:WHILE &child# <> ""
:SET &name# = XML_GET_NODE_NAME(&child#)
! Reading the application return code
:IF &name# = "RC"
: SET &applrc# = XML_GET_NODE_TEXT(&child#)
: PRINT "Applicationreturncode: &applrc#"
:ENDIF
:SET &child# = XML_GET_NEXTSIBLING(&child#)
:ENDWHILE
:XML_CLOSE
Access through the Job Report
The job report logs information about SAP job steps t. This report also informs about the application return code if you use the AE interface.
Notes:
- Appl-RC n/a is written to the job report if a step has no application return code.
- Use a script to read and process application return codes further. For more information, see PREP_PROCESS_REPORT.
The following example calls the ABAP ZZ_TEST_APPL_RC in a job once. Its application return code should be read.
! Select the line containing ABAP and the application return code.
:SET &HND# = PREP_PROCESS_REPORT(,,REP,"*ZZ_TEST_APPL_RC*Appl-RC*")
:PROCESS &HND#
: SET &LINE# = GET_PROCESS_LINE(&HND#)
! Find the exact position in a line where the "Appl RC" starts.
: SET &POS_STR# = STR_FIND(&LINE#,"Appl-RC")
! The application return code is located after 8 characters.
: SET &POS_ARC# = ADD(&POS_STR#,8)
! Read the application return code.
: SET &ARC# = STR_CUT(&LINE#,&POS_ARC#)
! Check if the step really supplies an application return code.
: IF &ARC# <> "n/a"
! The read value is a string and must therefore be converted to a number.
: SET &ARC# = CINT(&ARC#)
! Beyond this point there are any script statements which further process the application return code.
: PRINT &ARC#
: ENDIF
:ENDPROCESS
See also: