SAP Forms

With SAP Job objects you can execute a number of SAP functions directly from within the Automation Engine. For this purpose, Automic delivers Forms, that is, predefined sets of commands that depict those functions. Via the user interface you build scripts for SAP jobs without having to worry about their exact format.

This topic provides information on the following:

The Automation Engine Script Guide provides detailed descriptions on the syntax of the individual SAP script elements (commands) here: About SAP JCL.

Overview

Thanks to the integration with SAP systems, you can execute jobs in SAP directly from within the Automation Engine.

Your Automation Engine system is connected to SAP via the agent, which interprets and transforms the commands sent by the client so that SAP understands them. This means that the only prerequisites your system must meet to be able to create jobs via the Automic Web Interface and execute them in the SAP client are providing the necessary connection and login data, namely:

  1. The agent binaries are installed and its INI file is configured to connect to the Automation Engine.
  2. The SAP Agent is defined
  3. At least one Connection (CONN) object provides the necessary data for connecting the agent to the SAP application server (the user and his/her login data). See Connection Object (CONN).

    Take the following into account:

    • For SAP ABAP jobs, you need a Connection object of type R3/Remote Function Call.
    • For SAP Java jobs, you need a Connection object of type R3/Internet.
  4. A Login (LOGIN) object is defined that provides the necessary credentials for the job to be executed. See Login Object (LOGIN).

Please refer to the Technical Connection chapter for detailed information.

Once these prerequisites are met, you just have to build the scripts to be executed. You do so on the Process page of the SAP Job object definition.

Given the complexity of SAP functions, this can be really cumbersome. This is where the SAP Forms provided by the Automation Engine come into play. They are an additional, intuitive way to build scripts for SAP jobs using a graphical interface that provides ready-to-use commands.

Required Authorizations

To establish the connection to the SAP system, the SAP agent takes the SAP credentials (user name, password and client) from the Connection object for ABAP Basis. To be able to use the SAP Forms you need the following authorizations:

Synchronized Views - Script Editor/Form

Two views are available on the Process page of SAP jobs that you can toggle on/off using the buttons at the top of the page:

Both views are synchronized. Adding an SAP command via the Form view means that the corresponding code line is simultaneously written in the Script Editor; if you then populate the fields in the Form, these values are also written to the Script Editor.

Likewise, entering or editing script elements in the Script Editor results in the corresponding modifications in the SAP Form.

Instead of entering values in the fields of the SAP Forms you can use variable scripts. This also applies to the Script editor view, of course.

The synchronization of the values you specify for checkboxes and radio buttons is a special case. It is not possible to set their values in a script variable when using the script editor. If you do so, when you save the job, they will be overwritten by the values selected for those checkboxes/radio buttons in the Form view.

Example

You create a script that copies a report variant. Using the SAP Form view you simply add the Copy an Existing Variant command to the script designer and enter the values in the command fields:

Click to Expand

If you switch to the Script editor view, the script statement looks like this:

Click to Expand

Of course, entering or editing script elements in the script editor results in the corresponding modifications in the SAP Form as well.

Default Settings not Displayed in the Script Editor

Many command parameters have a default value. If you keep the default value when building your scripts, the Script Editor does not display these parameters.

For example, in the case of Copy an Existing Variant commands (R3_COPY_VARIANT), such as the one used in the previous example, the default for Protect Variant is No. This means that, by default, this checkbox is unselected. The Script Editor does not display this setting.

However, if you select it, that is, if you set a value other than the default, the Script Editor includes it. It looks like this:

Click to Expand

Combining SAP Commands With Non-SAP Commands

When building scripts for SAP jobs you may want to use not only SAP-specific commands but also the Automic scripting language, for example. You can enter these statements in the Script Editor.

If you do so and then switch to the Form view, non-SAP commands are grayed out to help you easily recognize them. For example, we add the following two lines to the statement depicted in the previous screenshot:

Click to Expand

Switch now to the Form view. This is how it looks like:

Click to Expand

Retrieving Values from the Target SAP System

With an active online connection to an SAP system it is possible to retrieve the values with which to populate the input fields, dropdown lists, etc. Click the button where available. For example:

Click to Expand

This opens a dialog that allows you to search for and retrieve data from the SAP client and insert it in your scripts. The contents and layout of the dialog depend on the nature of the data you need. It may display a list where you select a record and click Choose to insert it in the form field like this one:

Click to Expand

Or it may contain a pane on the right hand side, where you must filter the data, and a left hand side pane that displays the results of your filter criteria. For example:

Click to Expand

  1. Enter your search criteria on the right pane
  2. Click the Search button at the bottom of the pane.
  3. Select the appropriate record in the left pane.
  4. Click Choose at the bottom of this dialog.

    The selected record is inserted in the form field.

In both cases, information on the connection to the SAP system is displayed at the bottom of the dialog.

Working with the Criteria Manager for R3 and ABAP Jobs

With the SAP Criteria Manager you define conditions and criteria for events and combine them in dependencies that determine which events will be logged. To build up these conditions you connect standard ABAP options with AND and OR as logical operators:

The combination of criteria and conditions is stored in the criteria profile.

If you have been granted the SAP Criteria Manager right in your user definition and provided the connection to the SAP system is active, the Form view of R3 and ABAP jobs contains an additional Criteria Manager button on the toolbar. This button provides direct access to the Criteria Manager in your SAP system and allows you to do the following directly from the Automation Engine:

Interface versions lower than XBP3.0 are not supported.

Working with the Criteria Profiles Dialog

This graphic provides a short description of the Criteria Profiles dialog.

ClosedTo Filter the Profiles Displayed on the List

  1. Click the Filter button on the toolbar of the Criteria Profiles dialog to open a pane on the right hand side displaying all the filter possibilities.
  2. You can restrict the profiles to a particular Type.
  3. You can enter a Description or part of a description. This field uses implicit wildcards at the beginning and at the end of the string you enter. For example, entering DB_BACKUP actually triggers the filter for *DB_BACKUP*.
  4. By default, the Time Frame filter is set to No Time Frame. If you want to restrict the profiles displayed to those that were last modified within a specific time period, open the dropdown list and select Time Frame.

    Do one of the following
    • Activate From/To and select the time frame:

      1. Either type the date and time or click the icon to open the calendar view.
      2. Use the arrows at the top of the calendar view to select the month.
      3. Click on the date.
      4. Use the buttons at the bottom of the calendar view to specify a time.
      5. Do the same to define the end of the time frame.
    • Activate Last and specify the point in time on which the time frame begins. The end time is always the current timestamp.
  5. Click the Filter button to apply it.

Once you have filtered the contents of the list you can toggle off the Filter and leave more room for the remaining panes.

ClosedTo Add, Remove or Duplicate Profiles

ClosedTo Activate/Deactivate Profiles

Select a profile from the list and click Activate/Deactivate on the toolbar. Activated profiles display a tick in the Status column. There can be only one active profile per type.

ClosedTo Add, Remove or Rename Nodes/Criteria for a Profile

ClosedTo Define Fields and Values for the Criteria

The Criteria Manager and Automic Scripting

The Automic Scripting provides scripting elements associated with the SAP Criteria Manager. See About SAP JCL for an overview as well as the following topics for detailed descriptions of the available commands:

Script element Description
R3_ACTIVATE_CM_PROFILE Activates a profile in the SAP Criteria Manager
R3_DEACTIVATE_CM_PROFILE Deactivates a profile in the SAP Criteria Manager

See also Intercepted Jobs.

To Work with the SAP Form View

ClosedTo Add Commands to the Script

  1. Open the Process page of the SAP Job object.
  2. Click the button to toggle the Form view on.

    The Commands pane is displayed on the right hand side. This is where you build the SAP script using predefined commands.

  3. Click Add Command to open a dialog that displays all the available commands arranged in groups.
  4. Select the required one. You have two options:

    • Scroll through the list and expand the command group where the required one is located.
    • In the Search field at the top of the dialog start writing any word that is contained in the name of the command you need. The list below displays the commands that have the entered string in their names. For example:

      Click to Expand

  5. Click the Add Command button at the bottom of the dialog.

    The command is inserted on the pane and the corresponding input and selection fields are displayed on the main page.

  6. Populate the fields as required.

    With an active connection you can retrieve values from the SAP system. For this purpose, click where available.

  7. Continue adding commands and entering values until you have finished building the script.
  8. Save your changes.

Switch to the Script Editor view; the commands and the values you have specified are also inserted here.

ClosedTo Duplicate Commands

  1. On the Commands pane, right-click on the command you want to duplicate.
  2. A context-menu is displayed. Select Duplicate.
  3. The new, duplicated command is inserted immediately below the original one. All settings and selections made in the original command are also available in the new one.
  4. Save your changes.

ClosedTo Remove Commands

On the Commands pane do one of the following:

ClosedTo Change the Order of the Commands/Script Elements in the Script

The Form view allows to rearrange the order of the commands, whether SAP-specific or not, by dragging and dropping them. The commands in the Script editor are rearranged accordingly.

  1. On the Commands pane, click on a command or on a non-SAP statement to select it.
  2. Hold the mouse button to drag and drop it to the position where you need it.

    For example, the screenshot below shows how the Create a New Variant command is being dragged from the bottom of the commands list to a position between the two non-SAP statements:

    Click to Expand

  3. Save your changes.

ClosedTo Import Existing Jobs/Job Steps from SAP into the Current Script

When building a script, you can import code that is already available in jobs in the SAP system.

  1. Select the command after which you want to insert the job steps you want to import.
  2. On the Commands pane click the Import Job button.
  3. The Choose Job Name dialog is displayed, where you can search for the required job.
  4. Click OK.
  5. The required commands are inserted immediately after the selected command. The Search pane on the right allows you to filter and restrict the number of jobs that are displayed on the list.
  6. Select the appropriate job and click Choose to close the dialog.

The imported lines of code are inserted right after the command you had selected, both in the script and in the Forms view.

AE JCL for SAP

Script element Description
R3_ACTIVATE_CM_PROFILE Activates a profile in the SAP Criteria Manager
R3_DEACTIVATE_CM_PROFILE Deactivates a profile in the SAP Criteria Manager

See also: