Analyzing Problems with External Commands and Programs

Use

The following SAP system components play a part in the processing of external programs in a job:

This figure illustrates how the control program is started from a background work process through RFC and how the control program calls the external program itself. It also shows how the control program sends a message back to the application server through RFC.

The following problems can arise when processing external programs in a job:

  • The external program cannot be started correctly.

  • The external program cannot send its results back to the runtime system of the background processing.

Process

These problems can be analyzed as follows:

  1. Check the system requirements

    Ensure that the target system is set up correctly for running external commands and programs. See Prerequisites for Running External Commands and External Programs.

  2. Check the job log for error messages

  3. Activate the trace

    If the problem is not yet solved, you should activate the trace for the external program. When you schedule an external program in dialog (transaction SM36/SM37), you can activate the SAPXPG trace for a particular job step with the trace option in the Control Flags of the job step. You can also activate the SAPXPG trace as follows, without changing the job step definition:

    • For a particular external command (all job steps that use the command), with the trace option in transaction SM69

    • For all processing of external commands on a particular host system by setting the environment variable sapxpg_trace in the host system in which the external job is to be started. Format and values:

      sapxpg_trace=<Trace-Level>. The trace level can be 1, 2, or 3 where 3 is the most detailed. Trace level 0 deactivates the tracing.

    The trace recordings are written to the trace files listed above.

    All of these options activate SAPXPG's tracing, but have no effect on any tracing facility at the operating-system level or in the external program.

    If you use the function module JOB_SUBMIT to schedule a job step, then you must make the following parameter setting: EXTPGM_SET_TRACE_ON = 'X'.

    This creates the following trace files in the home directory of the gateway ID on the host on which the external program is to be executed:

    • dev_cp log off the R/3 control program sapxpg

    • dev_xpg Log off all output from the external program

    Check both trace files for error messages. You may find error messages in the gateway trace file dev_rd and in the system log on the server on which the job was started.