ABAP Job Management
Your AE system provides various ways that support processing in SAP. You can execute jobs that have been predefined in SAP or can run reports which are ABAP executable programs. You can run external commands or programs, intercepted jobs, and so on. 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 that is connected to the SAP system. This interface allows you to directly select data such as variants.
You can also use the RemoteTaskManager object type to monitor and start jobs in SAP. This object type is especially useful for intercepted jobs. See
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 AE, you can access its report which also includes 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
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 special 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 AE 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 jobcount. With this information, the job can be found in SAP.
-
You can deactivate child processes in the corresponding parent processes.
Lists of task executions and reports are created for each child process. You can open them through the particular Executions lists. See Execution Data
Reports of children 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:
-
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
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 that is 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 dynamically change table entries.
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. This report 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
Information about SAP job steps is logged in the job report. This report also informs about the application return code if you use the AE interface.
Notes:
- If a step has no application return code, Appl-RC n/a is written to the job report.
- Use a script to read and further process application return codes. 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: