Using SAP Execution Methods to Run JAMS Jobs

To run SAP Jobs, you can use a Sequence Task within a JAMS Sequence Job or one of two Execution Methods. The Sequence Task uses the definition that is maintained within SAP and uses JAMS for the scheduling. For information on the SAP Sequence Tasks, see Sequence Tasks. The Execution Methods let you manage all the steps and their details within JAMS. They are used to support Job execution processes using SAP outside the SAP Business Objects Data Services Integration Pack.

Two SAP Execution Methods are available:

  • SAPJobV2 provides support for executing multi-step background Jobs. It is also the replacement for the SAPJob and SAPStandardJob Execution Methods.
  • SAPProcessChain provides process chain execution handling in JAMS.

When you create a Job using an SAP Execution Method, it is submitted and executed normally in JAMS. For SAPJobV2, the JAMS log file displays the Job Number that matches in the entry in the SAP Client view. For SAPProcessChain, the Job output includes a process chain number (log ID). The JAMS log file displays the output of the process chain.

NOTE:

To use the SAP Process Chain and SAPJobV2 Execution Methods, you must have the following:

  • SAP ERP Central Component (ECC) 6.0, with SAP Enhancement Package 7 (EHP) or newer.
  • SAP NetWeaver 7.4 or newer.
  • SAP Environment must be a Unicode system.
  • Microsoft Visual C++ 2015-2022 Redistributable Pack (x64) installed on the JAMS Scheduler server.

The two screenshots below highlight these Execution Methods along with their respective Parameters. If you have already created the JAMSSAPServer and JAMSSAPClient Parameters, you can continue to use them. However, the recommended approach is to set the SAP Server and Client information within the SAP Connection in the Connection Store.

NOTE:

To define an Instance Number on your Execution Method, you have two options:

  • Use the Connection in the Connection Store. For the SAP (Custom Application Server) Connection, set the Application Server and Instance Number. Using the Connection Store is the preferred method, but any existing Parameters are supported for backward compatibility.
  • Use the JAMSSAPServer Parameter. Set the JAMSSAPServer parameter to "Servername:InstanceNumber" for the given Execution Method. For example, if the server was "192.0.2.0" and the Instance Number was "23", set the JAMSSAPServer parameter to be "192.0.2.0:23".


SAP Connections and Credentials

Before you create a Job, ensure you have created a Credential in JAMS and a Connection in the Connection Store. For the Connection, two SAP connection types are available.

Review the following items regarding creating a Connection or a Credential:

  • The SAP user in the SAPCredential property on the SAP Connection must reference a JAMS Credential that has been configured for a SAP user with the permissions outlined in the "SAP Configuration Requirements" section below.
  • The Credential in JAMS should have the same username and password as the credential in SAP.
  • SAP Instance Numbers are used to define the listener port. The port is defined as "33XX", where "XX" is the Instance Number. If the Instance Number was"23", the SAP port would be "3323".
  • To define language on an SAPJobV2 Job or an SAP Process Chain, specify the Logon Language within the Connection that you create in the Connection Store.

See JAMS Security: Working with User Credential Definitions and Connections for Integrations for more information.

NOTE: To run SAPJobV2 and SAP Process Jobs on an Agent, ensure the SAP Integration Pack from the JAMS installer is installed on the Agent.

SAP Configuration Requirements

These permissions describe the necessary roles and permissions in SAP to allow users to run a Job using the JAMS SAP  Integration.

SAP_BC_BATCH_ADMIN -- This role contains all authorizations for background processing administration, including the creation of background jobs and general administrations functions (SMxx transaction codes, in particular SM36, SM37, SM50, and SM51).

SAP_BC_ENDUSER -- This role contains non-critical basis authorizations for all users, including job creation and job release.

S_BTCH_ADM -- This role allows user the ability to perform any operation on any job, including:

  • Selecting jobs from all clients (from the Job Overview, Transaction SM37)
  • Deleting any job
  • Releasing jobs to start
  • Changing jobs, including copying, canceling, checking, repeating, and capturing and debugging
  • Displaying jobs, job steps, and job logs
  • Triggering events manually (transaction SM64)
  • Editing system events
  • Working with raised events in the event history (transaction SM62)
  • Using restricted job classes A or B
  • Scheduling an external program in a job

S_XMI_XBP_A -- This profile needs to be added to the SAP user to allow JAMS to execute an SAP Job or Process Chain.

Five User Type are available in SAP. Based on SAP recommendations, the User should be “System”.

Type Purpose
Dialog Individual, interactive system access.
System Background processing and communication within a system (such as RFC users for ALE, Workflow, TMS, and CUA).
Communication Dialog-free communication for external RFC calls.
Service Dialog user available to a larger, anonymous group of users.
Reference General, non-person related users that allows the assignment of additional identical authorizations, such as for Internet users created with transaction SU01. No logon is possible.

Overview of the properties of users with different user types.

Property \ User Type Dialog Communication System Service
Dialog Logon (SAP GUI) X - - X
Multiple Logons - X X X
RFC Logon X X X X
Background Job Execution X - X X
Password Change X X - -
Logon Ticket can be Generated X X - -

"X" represents Yes.

SAP Function Modules

Customers running SAP Jobs in secure SAP environments with heavy restrictions on function modules will need to allow the following modules

BAPI_XMI_LOGON BAPI_XBP_JOB_START_ASAP BAPI_XBP_JOB_ADD_ABAP_STEP
BAPI_XMI_LOGOFF BAPI_XBP_JOB_COPY BAPI_XBP_ADD_JOB_STEP
BAPI_XMI_SET_AUDITLEVEL BAPI_XBP_JOB_ABORT BAPI_XBP_EXT_COMM_SEARCH
BAPI_XBP_MODIFY_CRITERIA_TABLE BAPI_XBP_EVENT_RAISE RSPC_API_CHAIN_GET_STATUS
BAPI_XBP_GET_INTERCEPTED_JOBS BAPI_XBP_JOB_JOBLOG_READ RSPC_API_CHAIN_GET_PROCESSES
BAPI_XBP_JOB_STATUS_GET RSPC_API_GET_CHAINS RSPC_API_PROCESS_GET_LOG
BAPI_XBP_VARIANT_CHANGE BAPI_XBP_JOB_READ RSPC_API_PROCESS_SKIP
BAPI_XBP_VARINFO BAPI_XBP_JOB_SELECT RSPC_API_PROCESS_RESTART
BAPI_XBP_OUTPUT_DEVICE_SEARCH BAPI_XBP_JOB_DEFINITION_GET RSPC_API_CHAIN_RESTART
BAPI_XBP_REPORT_SEARCH BAPI_XBP_JOB_CHILDREN_GET RSPC_API_CHAIN_INTERRUPT
BAPI_XBP_VARIANT_INFO_GET BAPI_XBP_JOBLIST_STATUS_GET RSPC_API_CHAIN_START
BAPI_XBP_JOB_DELETE BAPI_XBP_JOB_OPEN RSPC_PROCESS_FINISH
BAPI_XBP_JOB_START_IMMEDIATELY BAPI_XBP_JOB_CLOSE RSPC_API_CHAIN_GET_LOG

SAP Multi-Step Job (SAPJobV2)

Creating an SAP Multi-Step Job (SAPJobV2) in JAMS

  1. On the Home screen, click Create a Job. 
  2. Select JAMS Integration Jobs.  
  3. Select  Create an SAP multi-step job. If you do not see the Jobs, close JAMS, install the Integration Pack again, and reopen JAMS. 
  4. On the Add a New JAMS Job Definition screen, do the following:
    1. In the Folder field, select a folder where the Job will be saved.
    2. In the Name field, enter a name for the Job.
    3. Optional - In the Description field, enter a description for the Job.
    4. Optional – In the Scheduled Date field, select a date for the Job to start.
    5. Optional – In the Calendar field, select the calendar to use.
    6. Optional – In the Scheduled Time field, select the time for the Job to start.
    7. Click Ok.
  5. On the Job Definition screen, click the Source tab.
  6. In the SAP Connection field, select the appropriate Connection that was created in the Connection Store.
  7. In the Job Name field, verify the correct Job name is displayed.
  8. In the Job Class field, set the scheduling priority for the Job to High, Medium, or Low.
  9. In the Target Server field, enter the server where the Job will run. If you do not select a server, SAP will select the server and load balance.
  10. Review the Wait for Child Jobs checkbox. Select the checkbox to force the parent Job to wait for the child Jobs to complete or clear the checkbox to allow the parent Job to complete before the child Jobs have run (finished).
  11. Review the Execute Immediately checkbox. Select the checkbox to have the SAP Job run immediately, or clear the checkbox to have the Job run ASAP.
  12. Click the Save & Close icon or add a Job Step.

Adding Job Steps

  1. On the Source tab, click Add in the Job Steps section.
  2. On the Step tab, do the following:
    1. Select ABAP, Command, or Program as the type of Step. The available options on the Step tab change based on the selected type.
    2. In the Name field, enter or select the name of the Step. This field will automatically populate options based on the ABAP and Command types.
    3. In the Variant field, enter the Variant. (This option is available for only the ABAP option.)
    4. In the Parameters field, enter the Parameters that will be passed to the Command or Program type. (This option is available for only the Command and Program options. )
    5. In the Operating System field, enter the operating system where the Command will run. (This option is available for only the Command option.)
    6. In the Target Server field, enter the server where the Step will run.
    7. (Optional) In the User Name field, enter the SAP user name that will be used to run the Step. This user does not need to exist as a Credential in JAMS, and it lets you specify a user other than the ExecuteAs user on the Job.
  3. On the Options tab, review and update the options below as needed. (Additional information can be found in the SAP documentation.) This tab is disabled for the ABAP step.

    1. Select the Log output checkbox to set an indicator in SAP to write the standard output for an external command or program to the SAP job log.
    2. Select the Log errors checkbox to set an indicator in SAP to write the standard error output for an external command or program to the SAP job log.
    3. Select the Wait for termination checkbox to set an indicator in SAP for an external command or program run synchronously or asynchronously.
    4. Select the Enable Trace checkbox to set an indicator in SAP if SAP tracing level 3 is activated for tracing SAPXPG, the program that starts an external command or program.
  4. On the Output tab, review and update the optional properties below as needed. This tab is disabled for the Command and Program steps.
    1. In the Output Device field, select the output device that is configured in SAP. This field will automatically populate options based on the Output Devices configured within SAP.
    2. In the Format Type field, select the format for the output.
    3. In the Title field, enter a title for the output.
    4. In the Department field, enter the name of the department.
    5. In the Copies field, enter the number of copies that will be created.
    6. In the Start Page field, enter the start page for the output.
    7. In the End Page field, enter the end page for the output.
  5. Click OK.

SAP Process Chain

Creating an SAP Process Chain Job in JAMS

  1. On the Home screen, click Create a Job.
  2. Select JAMS Integration Jobs.  
  3. Select Create an SAP Process Chain job. If you do not see the Jobs, close JAMS, install the Integration Pack again, and reopen JAMS. 
  4. On the Add a New JAMS Job Definition screen, do the following:
    1. In the Folder field, select a folder where the Job will be saved.
    2. In the Name field, enter a name for the Job.
    3. Optional - In the Description field, enter a description for the Job.
    4. Optional – In the Scheduled Date field, select a date for the Job to start.
    5. Optional – In the Calendar field, select the calendar to use.
    6. Optional – In the Scheduled Time field, select the time for the Job to start.
    7. Click Ok.
  5. On the Job Definition screen, click the Source tab.
  6. In the SAP Connection field, select the appropriate connection that was created in the Connection Store.
  7. Next to the Process Chain field, click the … button.
  8. On the Find SAP Process Chain dialog, enter a name or description to find the correct process chain.
  9. Click Find.
  10. Select the process chain.
  11. Click Ok.
  12. Click Save and Close.

Submitting an SAP Job

  1. In the JAMS Shortcuts menu, click Definitions.

  2. Expand the folder containing the SAP Job.

  3. Right-click the Job and select Submit. The Submit dialog is displayed.

  4. Click Submit Run Request.

Resuming a Process Chain

If a process fails inside the process chain, you can resume the process chain from the JAMS Monitor view. When the process fails, the icon for the process chain in the Monitor view will change. The Job stays in the "Executing" state, but the execution is halted until you select an option as described below.

SAP Process Chain Execution Method

To resume a failed process chain when you are using the SAP Process Chain Execution Method:

  1. From the JAMS Shortcut menu, click Monitor.

  2. Right-click the Job and select Release.

  3. On the Release Job dialog, select one of the following options:

    • Release from wait with retry - Retry the failed process in process chain before continuing.
    • Release from wait - Skip the failed process and resume the process chain.

SAP Process Chain Sequence Task

To resume a failed process chain when you are using the SAP Process Chain Sequence Task:

  1. From the JAMS Shortcut menu, click Monitor.

  2. Double-click the entry for the Sequence Job.

  3. Click the Sequence tab. The Sequence editor is displayed.

  4. Right-click the Task in the Design area and select one of the following options:

    • Retry Failed Processes - Retry the failed process in process chain before continuing.
    • Skip Failed Processes - Skip the failed process and resume the process chain.
    • Cancel Process Chain - Stop the process chain. The Task completes successfully.

Parallel Execution for JAMS and SAP Jobs

Once JAMS submits the Job, SAP creates and executes a parallel job as shown in the following two screenshots.

Job Execution Logs

Once a Job executes, logs can be viewed from either the JAMS or SAP environments.

Authorized users may, in certain cases, cancel a currently executing Job. In SAP, such a job would go into a cancelled state. Logs can then be checked in both environments.

Related Topics