Background Job

Post on 04-Sep-2014

167 views 9 download

Tags:

Transcript of Background Job

Connecting External Job ManagementSystems to the R/3 CCMS Job

Scheduling SystemXBP External Interface for Background Processing

External Interface forBackground Processing

Release 4 .5

2

Copyright1999 including screen shots by SAP AG. All rights reserved.

Neither this documentation nor any part of it may be copied or reproduced in any formor by any means or translated into another language, without the prior consent of SAPAG.

SAP AG makes no warranties or representations with respect to the content hereof andspecifically disclaims any implied warranties of merchantability or fitness for anyparticular purpose. SAP AG assumes no responsibility for any errors that may appearin this document. The information contained in this document is subject to changewithout notice. SAP AG reserves the right to make any such changes withoutobligation to notify any person of such revision or changes. SAP AG makes nocommitment to keep the information contained herein up to date.

TrademarksSAP and ABAP/4 are registered trademarks of SAP AG.

All other products mentioned in this documentation are registered or unregisteredtrademarks of their respective companies.

3

Contents

1. INTRODUCTION 6

2. THE FUNCTION OF EXTERNAL INTERFACES 7

3. THE REST OF THIS DOCUMENT - AN OVERVIEW 8

3.1 A Note About This Document 8

4. A SHORT INTRODUCTION TO R/3 BACKGROUND PROCESSING 9

4.1 Motivation 9

4.2 Concept 94.2.1 Creating Jobs 104.2.2 Releasing a Job 114.2.3 Starting Jobs (Ready and Active) 124.2.4 Ending a Job (Canceled or Finished) 12

4.3 Architecture of the R/3 Job Scheduling System 134.3.1 Job Administration in the Database 134.3.2 The Job Scheduler 134.3.3 The Job Starter and the Job Runtime Environment 144.3.4 The Job Log 144.3.5 Job Output 15

5. THE EXTERNAL INTERFACE CONCEPT 16

5.1 The Range Of Interfaces 16

5.2 Naming Conventions 17

5.3 Technical Basics 185.3.1 XMI Monitor: External Access 185.3.2 RFC Remote Function Call 19

6. XBP - EXTERNAL JOB SCHEDULING INTERFACE (JOB-API) 22

6.1 What Is Required of the Interface 22

6.2 XBP Interface - Description 22

7. XBP REFERENCE MANUAL 25

7.1 Requirements For Using The XBP Interface 257.1.1 Logging On To The R/3 System With An External Job Management System 257.1.2 External Job Management System - Logging Off 27

7.2 Defining Jobs 287.2.1 Job Open 287.2.2 Assigning an ABAP/4 Program to a Job Step 297.2.3 Assigning an External Program to a Job Step 317.2.4 Close Job Definition 33

4

7.2.5 Reading Job Definitions from the SAP R/3 System 347.2.6 Determine Number of Jobs With Particular Job Name 357.2.7 Selecting Jobs 36

7.3 Starting a Job 377.3.1 Start Job Immediately 377.3.2 Start Job As Soon As Possible 39

7.4 Modifying Steps in a Job 407.4.1 Modifying a Job Step Containing an ABAP/4 Program 407.4.2 Modifying a Job Step Containing an External Program 42

7.5 Finding Job Monitor Data 447.5.1 Determining the Status of a Job 447.5.2 Read Job Log 467.5.3 Read the Spool List of a Job 487.5.4 Checking the Status of a Job 50

7.6 Controlling Jobs 527.6.1 Aborting a Job 527.6.2 Deleting a Job 53

7.7 General Help Functions 547.7.1 Show All Defined Variants of an ABAP/4 Program 547.7.2 Determine Current Resources for Jobs in the R/3 System 567.7.3 Check Available Job Resources at a Particular Time on a Server 587.7.4 Check Available Job Resources at a Particular Time in the Whole R/3System. 60

8. APPENDIX 618.1.1 The BAPI Return Structure 618.1.2 Message IDs and there meaning 618.1.3 Reading Syslog Entries in the R/3 System (Part of the XMB Interface) 64

5

Release Information for XBP Version 4.5 - 1998

• This XBP version will be delivered with version R/3 Release 4.5A

• This version of the interface introduces the XBP-BAPIs. That is an objectoriented approach to accessing much the same functionality as beforewith the regular XBP functions.

• For the purpose of switching the interface to objects and methods (BAPIs)we had to rename all of the function module names. They are nowaccording to the BAPI conventions. The old names will be kept forcompatibility reasons but should be no longer used.

• The old function module names SXMI_* are obsolete and will be deleted in2 releases from now (=4.5A)

• Due to the BAPI conventions the exceptions used in XBP version 0.1 areno longer supported. Instead you can analyze the structure BAPIRET2which delivers the original MessageIDs as messages.

• A lot of type names have changed. The actual technical types (in C/C++terms) remained almost identical. Except for the print parametersmentioned above and the BAPIRET2.

• For a very short period we have to maintain old names, new names andobjects (rather classes) with methods. In the near future old names will bedeleted from this documentation.

• New parameter in BAPI_XBP_JOB_CLOSE. Optional and thereforecompatible to previous versions.

• TARGET_SERVER is no longer specified in the Close method but ratherint the starting calls BAPI_XBP_JOB_START_ASAP andBAPI_XBP_JOB_START_IMMEDIATELY

• Another new parameter in BAPI_XBP_VARIANT_INFO_GET. Optionaland therefore compatible to previous versions. Helps selecting‘background only’ variants.

• Enhanced parameter for print parameters inBAPI_XBP_ABAP_STEP_MODIFY and BAPI_XBP_ADD_ABAP_STEP

• For a very short period we have to maintain old names, new names andobjects with methods. In the near future old names will be deleted from thisdocumentation.

• New Function - rather BAPI - named BAPI_XBP_JOB_SELECT

• New Function - rather BAPI - named BAPI_XBP_JOB_DELETE

6

1. IntroductionThis document deals with the connection of an external job management system to theR/3 System. By external job management, we mean software which allows jobs to bescheduled, run and monitored from outside the R/3 System.

For this purpose, SAP has defined an open generic interface. This is called XBP, whichstands for eXternal interface for job Background Processing. XBP is one of a range ofopen interfaces which SAP intends to make available in the future for systemmanagement tasks. R/3’s internal CCMS (Computing Center Management System),with this range of interfaces, offers support to software manufacturers by allowingintegration with existing system administration tools.

7

2. The Function of External InterfacesThe motivation for the development of these external interfaces arose from the desireto let SAP installations - especially large ones - be overseen by other softwarevendors’ tools.

ExternalSystem Administration Tool

R/3 System

OpenInterfaces

Fig. 2.1: Location of external interfaces

External interfaces allow you to integrate R/3 simply and seamlessly into both localadministrative tools and business-wide system management infrastructures. Thisintegration should not and cannot completely replace the use of CCMS. Complex andsecurity-critical system control tasks will always need to be carried out by CCMS.Furthermore, CCMS basic functionality is expected and required by R/3 applications.To explain by example: even if you use an external scheduling tool for backgroundjobs, the internal job system in R/3 is still required to carry out the background jobsgenerated by applications such as R/3 archiving or the Workbench.

The aim of the integration is to allow the customer a homogenous informationinfrastructure. The aim of the interface is to facilitate the flow of information betweenthe R/3 System and external tools.

In summing up, we could say that external tools provide additional flexibility tocomplement the existing basic functionality of CCMS.

8

3. The Rest of This Document - An OverviewChapter 4 of this document contains a global description of the R/3 job managementsystem. This short introduction demonstrates the concept and the components behindthe system, without going into too much detail or starting to discuss the interface.

In chapter 5 there follows an overview of the whole range of external APIs planned bySAP.

Chapter 6 contains the actual description of the XBP; the motivation behind it, itstechnical background and a functional overview. This is all intended as anintroduction. A reference manual follows in chapter 7. This is provided to help with theimplementation of external agents.

3.1 A Note About This DocumentWe have assumed that the reader will already have a certain degree of knowledge ofthe R/3 System.

You should already be familiar with terms like application server, dispatcher, schedulerand work process in relation to R/3 basis. Additionally, you need to know at least whata function module is.

9

4. A Short Introduction to R/3 BackgroundProcessing

Firstly, we need to explain why background processing has a place in a dialog-orientedstandard application. What is a ‘job’ within the R/3 System, and how does the systemcarry it out?

We intend to demonstrate the concept using an example. Afterwards, we will introducethe architecture of background processing as a system.

4.1 MotivationR/3 is, above all, an interactive system. In other words, the vast majority of tasks arecarried out in dialog with the user. However, there are also good reasons for theinclusion of a background processing system in R/3:

• Mass data processing pushes a real-time system like R/3 right to its limits.Response times measured in hours mean that interactive processing is just not aviable option.

• Tasks sometimes need to be carried out at times when no competent user isavailable to carry out the dialog.

• Periodically recurring jobs need to be carried out at exact times, or on Sundays orPublic Holidays.

• Existing job structures are to be inherited from other, maybe older systems.

4.2 ConceptA single unit to be processed in background processing is called a job. Accordingly,you will also see the term ‘job scheduling’ crop up in this area.

Generally speaking, a job accomplishes a task, in the sense of an application. Forexample, you can use a job to carry out a firm’s payroll run at the end of the month.

Jobs are identified on the one hand by their name (Ex.: PAYROLL_RUN). Howeversince these names are not unique if the same application job is repeated, jobs alsohave job numbers, which ensure that they have a unique identification.

A job does not have to consist merely of one program call, but may contain several.These constituent parts of a job are known as steps. Thus a job may contain one ormore of these steps. Each step calls either an ABAP/4 program or an externalprogram. An external program can be either a shell script or an executable programwritten, for example, in C code.

Whilst several jobs may be started one after the other in any order you choose, thesteps within a job are always carried out in the sequence in which they have beendefined.

Jobs have a life cycle - they are created (scheduled), released, are ready, becomeactive, and finally are finished or canceled. We talk of the statuses that a job canhave. Figure 4.1 shows the chain of these statuses:

10

Sched- Released Ready Active uled

Finished

Canceled

Fig. 4.1: Status chain for jobs.

In the following sections, we follow the life cycle of a job systematically. Figure 4.2shows an example of the activities which can cause a job to change status. A job,‘scheduled’ by a program, is ‘released’ by a dialog. It then proceeds through the ‘ready’and ‘active’ statuses with help from R/3 system programs. If everything has goneaccording to plan, the job status moves on to ‘finished’. A program error will lead to afinal status of ‘canceled’.

Sched- Released- Ready Active uled

Finished

Canceled

ABAP/4Program

in dialog Job scheduler Job starter

WorkProcess

Programerror

Fig. 4.2: Status chain for jobs with possible causes of status change.

You can see the current status of a particular job in the R/3 System using the joboverview (Transaction SM37).

4.2.1 Creating JobsYou can regard a job as a list of steps plus administrative information - “Where andhow is the job run?”. To create a job, you assign existing program for the steps, thenadd the administrative information.

There are three ways of bringing this administrative information into the R/3 System; ina dialog, from an ABAP/4 program, or, in future, from an external program using XBP:

1. in a dialog (Transaction SM36, or Tools è Administration è Jobs è Define Job)Here you enter the job name, job class and, if necessary, a target machine. Next,you enter a list of steps, and a start time, if required.

2. new jobs are created from ABAP/4 programs using the JOB_OPEN, JOB_SUBMITand JOB_CLOSE function modules. You have the same parameters and degree offreedom here as in the dialog.

3. XBP allows you to use the functionality described in (2) in conjunction with externalprograms and agents.

In each of these cases, the job number is created by the system itself to ensure thatthe job has a unique identification. Figure 4.3 shows the specification of a newlycreated job, with its name, number, status and steps.

11

Jobname: PAYROLL_RUNJobcount: 14201001Status : scheduledTarget host : -Start criteria :Step1 : GHLTBRUTStep2 : URLAUBAB.....Log :

Fig. 4.3: A created job from the system’s point of view (greatly simplified)

If no target machine is specified for the job in the dialog or the ABAP/4 program, thesystem decides itself on which application server the job is to be carried out. This isthe normal procedure recommended by SAP, because the system can then carry outits own load balancing. You should only specify the target machine if that server hasparticular resources which are necessary for the job processing.

4.2.2 Releasing a JobA job is released when you specify a start time for it. You can release a job as soon asyou create it, by specifying the start time. In this case, the job does not appear asscheduled, but assumes released status straight away. Once released, a job is fullydefined from the point of view of the user or the ABAP/4 program. However, this doesnot necessarily mean that it can be started straight away.

Put simply, a job is started when its determined starting time is reached. In thedifferent applications, there are different requirements regarding the setting of asuitable start time, and there are therefore several variants, known as start criteria.

In the simplest of cases, the user enters a starting time (Ex..: PAYROLL_RUN on1.31.97).

Now comes the question of whether you want to specify all repetitions of the job at thesame time (for example, execute monthly). Here things have already becomecomplicated (2.31.97 doesn’t exist). There are many possibilities and exceptionalcases.

For this reason, we do not just have the start time, but a total of five start criteria:

1. Immediate A job is executed as quickly as possible.

2. Date/ time A job is started when its start date and time arereached.

3. Event A job is started when a particular event is triggered inthe system or by a program at operating system level.E.g. when data for processing is imported to a serverby file transfer.

4. Preceding job A job is started once a particular preceding job hasrun.

5. Change of operationmode

A job starts once the R/3 System has switched into aparticular operation mode.

6. Start on working day A job is started when a particular working day of themonth is reached Ex. the last working day of a month.

Once you have released a job by setting a start time, the Job scheduler in the R/3System becomes responsible for the future progress of the job.

For some of the above start criteria you can also specify that the job should recur.Thus you can ensure that a new job with the same name, but a different job number for

12

each repetition, is released, for example, each time a particular event occurs, or everyday from today.

In selecting start criteria, you can use various calendars, either pre-defined or user-defined. This allows you a still greater degree of freedom, by allowing you to specifydeviations in the frequency of periodic jobs (E.g. carry out periodically, but not onPublic Holidays)

Jobname: PAYROLL_RUNJobcount: 14201001Status : releasedTarget Host : -Start criteria : last workday of monthStep1 : GHLTBRUTStep2 : URLAUBAB.....Log :

Fig. 4.4: A released job from the point of view of the system (greatly simplified).

Figure 4.4 shows that as well as the status changing, the start criteria have been laiddown in the job description.

4.2.3 Starting Jobs (Ready and Active)Within the system, the Job scheduler is responsible for the progress of released jobs.For each job, the scheduler monitors whether its start time has been reached or itsstart criteria met. This is done periodically - every 60 seconds as a rule (you can setthis as a system parameter).

As well as this, the job scheduler has to ensure that sufficient system resources areavailable for a job to be carried out. The most important system resources in this caseare background work processes. These are work processes which are reserved forbackground processing.

The Job scheduler ignores jobs whose start time has not been reached. Jobs whichshould have started, but for which no free work process was available, are checkedconstantly. When the job scheduler finds a free work process, it sets the job to readyand tells the background work process that work is waiting.

,Jobname: PAYROLL_RUNJobcount: 14201001Status : activeTarget host : -Start criteria : last workday of monthStep1 : GHLTBRUTStep2 : URLAUBAB.....Log : JOBLGX142010X1234

Fig. 4.5: An active job from the point of view of the system (greatly simplified).

A job becomes active when the background work process, which carries out its steps,runs the jobstarter prior to carrying out the first step. As figure 4.5 show, the jobdefinition has now gained a link to a job log.

4.2.4 Ending a Job (Canceled or Finished)A job logs its steps in a job log, which is visible to the user. If everything runsaccording to plan and no errors occur, the job acquires ‘finished’ status. This can beseen both in the job log and the dialog in Transaction SM37.

13

If an ABAP/4 error or any other interruption occurs at runtime, an error message isrecorded in the job log, and the job is terminated.

Jobname: PAYROLL_RUNJobcount: 14201001Status : finishedTarget host : -Start criteria : last workday of monthStep1 : GHLTBRUTStep2 : URLAUBAB.....Log : JOBLGX142010X1234

Fig. 4.6: A finished job from the point of view of the system (greatly simplified).

Figure 4.6 shows the final view of the job. The job status is ‘finished’. Furtherinformation can be seen in the log.

4.3 Architecture of the R/3 Job Scheduling SystemThe essential components of the R/3 background processing are the database tableswhich contain the job administration data and steps, the job scheduler, job starter, thejob log and the spool subsystem.

Within this document we can only present a rough sketch of how these elements worktogether. The aim is, however, to provide a simple model of how the system works.

4.3.1 Job Administration in the DatabaseAll essential job administration information and the job steps themselves are stored inthe database. This ensures the consistency and security of the relevant information.

The most important of the database tables is the job data table. This contains entriesnecessary for job administration: job name, job number, target host, desired start time,job log name and much more. The step list for a job is not contained in this table.

The step list table contains a number of ABAP/4 and operating system level programs(‘external programs’) for each job. Figures 4.3 - 4.6 show data from both tables in oneview.

An event table lists all events defined in R/3, along with the jobs that they trigger whenthe particular event occurs in the system.

4.3.2 The Job SchedulerIn actual fact, the job scheduler consists of two schedulers - one for event based andone for time based jobs. According to the start criteria for a particular job, one or theother of these schedulers assumes responsibility for passing it on. For the sake of thisoverview, we will make no further distinction between the two schedulers.

The job scheduler for time controlled jobs is started regularly on all the applicationservers in the R/3 System which carry out background processing and havebackground work processes for that purpose. You can set the interval at which it isstarted as a profile parameter for each application server. The event driven jobscheduler is started on the application server on which an event is triggered. You candetermine which application server looks after events by setting a profile parameter.

When the scheduler begins its task, it selects jobs from the database (jobadministration data) which have reached their start date or whose triggering event hastaken place. The scheduler also takes into account whether any background workprocesses are free, If it comes across free processes of the right type, it tries to send

14

as many jobs as possible to these processes, always bearing in mind the priority of the‘ready’ jobs and maintaining a reserve of background work processes for importantclass A jobs. Jobs which cannot be processed are left untouched. Jobs, on the otherhand, which are sent to the background work processes are marked as such in thedatabase (‘ready’ status) and, after a short delay. are taken up by the chosen workprocess and processed completely (without interruption).

The job scheduler is responsible for informing the work process about its next task, forcreating new job contexts for recurring jobs with a new start time and job number, andstoring these in the database.

,R/3Database

Dispatcher

ApplicationServer

Job Scheduler Job Starter

... .......

WP0 Dialog-WP Batch-WP WPN

ABAPsJobs Steps

1.2.

Fig. 4.7: System architecture of R/3 background processing (simplified).

4.3.3 The Job Starter and the Job Runtime EnvironmentThe job starter is a compact program which is processed in the background workprocess and finds a step list in the database. The step list is then processed step bystep. If an external program is involved, a UNIX or Windows NT command is sent tothe operating system. If the step consists of an ABAP/4 program, this is carried out inthe R/3 System.

The user and the operating system-specific environment variables are essentialruntime settings, which must accordingly be specified for each step.

4.3.4 The Job LogGenerally speaking, the job log is not stored in the database. It is a TemSe object, andusually a file at operating system level. The TemSe objects are temporary andsequential R/3 objects, which can be stored system-wide in the database, but arenormally kept directly in the file system. In any case, the name of the TemSe object -normally the filename - is stored in the job administration information.

If a job log is requested for a job, the TemSe object is displayed. The user cannot tellfrom the dialog whether this is a database object or whether it has been saved in adifferent way.

15

4.3.5 Job OutputMost ABAP/4 or external programs generate output whilst they are running. Possibleoutput includes error messages, messages about a program’s progress, or listsresulting from a report.

These outputs and messages are not immediately visible, since the programs are notrunning in dialog, but in the background. To avoid this output being lost, it is saved sothat it can be looked at later. Any messages classed as ‘harmless’ and output lists arelooked after by the spool output management (TemSe). All error messages arerecorded in the job log. The job log contains information on all job steps.

The step list stores information on the location of the output of each job. The reasonfor this is that each step can create its own output.

16

5. The External Interface ConceptThe XBP interface described in this document is part of an interface package forexternal system management tools which SAP intends to release in the near future.On the R/3 side, the interfaces will be constructed through a pool of function modules.External management systems will be able to call these using RFC (Remote FunctionCall). You can find example calls in the documentation on the interface itself. A shortintroduction to RFC forms part of the technical basics at the end of this chapter.

In the following section, we are working on the assumption that the external systemmanagement tool is represented to the R/3 System by an agent. This agent is thecommunication partner of the function modules.

5.1 The Range Of InterfacesThe range of interfaces, under the name XM (eXternal R/3 Management), consists atpresent of the following individual components:

•• XBP eXternal Interface for Background Processing

•• XBR eXternal Interface for Backup & Recovery (so far called: BRI or Backint)

•• XDB eXternal Interface for Database Admininstration and Monitoring

•• XMB eXternal Interface for Monitoring Basics

•• XMI eXternal Monitor Interface

•• XOM eXternal Interface for Output Management

•• XSP eXternal Interface for Printer Setups

It is possible that this list will be extended in the future.

In the following table you can see the abbreviated name of the interface (and itscurrent version), its implementation technique, the R/3 Release with which it will bedelivered and a short description. The certification column shows whether and when aconcrete interface can be certified. Only the abbreviations from the first column will beused in technical descriptions.

Abbr.l

Version

Technique

R/3

Rel.

Short Description Certifi-cation

XBP

1.0

RFC 3.1G Job scheduling API

Function modules for planning, releasing andmonitoring R/3 jobs.

poss.

BC-XBP

XBR

2.0

CLI

script

3.0D Backup Intergration API (also known as BRI)

Backup and recovery functions for databases

poss.

BC-BRI

XDB RFC 4.5 Database Admin API

Basic functions for database administration andmonitoring

no, onlyValidation

17

XMB

0.1

RFC 3.1G Basis API

Basis functions for monitoring basis function modulesfor scheduling, releasing monitoring R/3 jobs.

In

future

XMI RFC 3.1G External access to CCMS can be logged andmonitored.

poss.

with

BC-XBP

XOM

0.1

RFC

CLI

4.0A Output Management

Controlling and return messages for outputmanagement??

poss.

with

BC-XOM

XSP

planned

RFC 4.x Spool API

Monitoring and controlling for the spool system??

in

future

One thing which all of these RFC interfaces have in common is that their functionmodules call exactly the same function pools as the internal R/3 operations. Figure 5.1shows this using the XBP. This does not, of course, apply to the (later described) XMI,since there is no internal equivalent.

General Function Pool forBackground Processing

XBP

R/3

ExternalAccess R/3 Internal

Job Management

Agent

Fig. 5.1: The External Interface Principle, exemplified by XBP

Internal and external management use the same basic functionality.

It is planned to produce a document such as this one for each interface in the abovelist. There should be a description of the XMI functionality in all of these documents.

5.2 Naming ConventionsIt is aimed to have a standardized naming convention for function modules, and this iswidely kept to. Thus function modules for the XM- interface family have the prefixBAPI, an identification for the actual interface and arising from the target object andthe intended action.

Syntactic structure for a function module name: BAPI_<SS>_<Object>_<Action>

Example of the naming convention: BAPI_XBP_JOB_OPEN

18

In the example, the actual interface is signified by XBP (eXternal interface forBackground Processing).

5.3 Technical BasicsThe most important technical basics for the external APIs are XMI and RFC. Furthertechnical details concern R/3 profile parameters and the replacement of scripts andexecutables at operating system level. Here, we do not want to go into these last twotechniques, but rather to explore XMI and RFC.

XMI is an interface which logs the activities of users and agent programs each time afunction module is called. In particular, XMI logs the agent’s first access to the functionmodule pool. At this point, the name of the external program is recorded and itsversion number checked.

RFC (Remote Function Call) forms the communications platform for direct calls to thefunction modules which implement the interface on the R/3 side.

5.3.1 XMI Monitor: External AccessWithin R/3 all external CCMS interfaces use the same function modules. Thesefunction modules can also be collected into an interface themselves. The name XMI(eXternal Monitoring Interface) was established since the interface was intended to logexternal access.

XMI - logging and more CommonLayer

Interface-SpecificLayer

XMB XBP

ExternalAccess

General FunctionsBackground Processing .....

Fig. 5.2: XMI as a common layer for external interfaces.

For developers who want to integrate external tools into CCMS, the XMI interfaceremains almost invisible, appearing only at the beginning and end of a CCMS sessionin the form of two functions:

•• BAPI_XMI_LOGON: Agent logs on to an external interface

•• BAPI_XMI_LOGOFF: External program logs off from an external interface

You have the option of using a further function from the external tool

• BAPI_XMI_ENTER_LOGMSG: Writes a message to the XMI log

In the future there will be further function modules:

• BAPI_XMI_GET_VERSIONS: Queries the current version of the interface

• BAPI_XMI_SELECT_LOG: Reads the XMI message log

• BAPI_XMI_UPLOAD_MESSAGE_FORMATS: Loads language-specificmessages

19

The information which is logged and collected in the access log can be viewed usingTransaction RZ15.

The following is displayed: Name of the agent which tried to make contact with the R/3System, and that of its supplier, the user name (if a user logged on) and any changesor attempted changes which were carried out (for example, reset alert).

5.3.2 RFC Remote Function CallFunctions inside and outside of the R/3 System use Remote Function Call tocommunicate with one another. From a technical point of view, RFC is a library (in theC programming language) which is available on nearly all operating system platforms.

How it works.

RFC is a general concept, allowing communication between R/3 Systems or betweenan R/3 System and external programs.

In the case of an external system management tool we are dealing with an example ofthe latter, in which the program adopts the rôle of a client in relation to the R/3 System.The service offered by the application server involves the delivery of internal systeminformation or carrying out individual system management activities.

RFC works in sessions. In other words, the user opens an RFC, carries out RFC tasksand then concludes the session. In opening the session, the R/3 logon procedure, withuser ID and password, must be carried out. The user must be identifiable to andauthorized by the R/3 System. In other words, users must exist within the R/3 System,which are then used by the external agent. Obviously, you need to set upauthorizations for these users which correspond with the activities that they are to carryout.

RFC recognizes synchronous, asynchronous and transactional calls. The followingexamples use synchronous calls. For further details on the other types of call, see theappropriate RFC documentation.

The Most Important Functions

The most important RFC functions at a glance:

Name Short Description

RfcOpen( ) A connection is made with an application server. The connectioninformation is either specified directly or read from a file.

RfcCallReceive( ) Synchronous call from an RFC client

Activates a function module in an R/3 System. After processing, theclient calling regains control.

RfcCall( ) Calls a function module without waiting for it to end.

RfcLastError( ) A function allowing you to analyze RFC errors. Detailed information isgiven in stdout format.

RfcClose( ) RFC connection closed, session finished.

ItCreate( )

ItDelete( )

Storage space needs to be created and released when tables areexchanged between a client program and an R/3 System.

Further RFC Documentation

20

Other RFC functions and call forms are contained in the RFC tutorial.

R/3 ABAP/4 Development Workbench,

Remote Communications (SAP Documentation, Product Number = 50014371)

The documentation set ABAP/4 Development Workbench can be ordered (entire setonly) from the SAP department ‘Dokumentationsversand’. You can place your ordervia Fax 06227/34-1497 (current price: DM 250.-).

In the case you have a R/3 installation running äquivalent information is availableunder ‘Extended Help -> Basis -> ABAP Workbench -> Remote Communication’.

This documentation answers questions relating to parameter transfer and theconfiguration of an RFC connection (rfc-destinations using a file), as well as giving thesyntax of RFC functions with examples.

Before implementation, you are strongly recommended to consult this document eitheronline or as books.

Framework of a client RFC program in C

In order not to be too theoretical about RFC we have included a practical example.The framework of a program which is linked to the RFC library as an RFC client usingthe XMB interface would look something like this:

#include "saprfc.h"main(){

rfc_handle = RfcOpen(&rfc_opt);function = "BAPI_XMI_LOGON";.....

rfc_rc = RfcCallReceive( rfc_handle, function, exporting,importing, tables, &exception );

function = "BAPI_XMI_SELECT_LOG";......

rfc_rc = RfcCallReceive( rfc_handle, function, exporting,importing, tables, &exception );

/* a lot more action */

function = "BAPI_XMI_LOGOFF";.........

rfc_rc = RfcCallReceive( rfc_handle, function, exporting,importing, tables, &exception );

RfcClose(rfc_handle);

}

From this we can see the model for a session between an R/3 System and an externalmanagement tool. An RFC session contains one or more XMI sessions. Each XMIsession contains a series of function calls to the individual interface function module.

Open RFC session Authorization from R/3

Open XMI session for XBP Identification of XM

Call XBP functions Identification of agent user

Open XMI session for XMB Identification of XM

Call XMB functions Identification of agent user

Call XBP functions Identification of agent user

Close XMI session

Close RFC session

21

RFC is being developed further

Another small warning to finish with: the RFC interface is currently being developedfurther and improved. You should therefore always make sure that you have thecurrent version of the RFC documentation.

22

6. XBP - External Job Scheduling Interface(JOB-API)

The external job scheduling interface is often referred to as the JOB-API. However,this can lead to misunderstanding, since there is also a JOB-API in ABAP/4programming (see document: Programming the Background Processing System, R/3).To avoid the possibility of getting mixed up, we will try here to use the abbreviationXBP along with the name JOB-API whenever necessary. Only XBP-API can be used toconnect agents. You cannot use the internal background processing API for thispurpose.

6.1 What Is Required of the InterfaceIn order to be able to work in the R/3 System, an external job scheduling system mustbe able to carry out the following functions within the R/3 System:

• Define jobs

• Work with jobs

• Delete jobs

• Start jobs (start immediately)

• Terminate active jobs

• Access information about jobs (status, log, ...)

• Access information about resources in the R/3 job scheduling system (number andstatus of background work processes)

Any critical changes to R/3 jobs (creation, editing, deletion etc) are recorded in the XMIlog in the R/3 System. You can display entries in this log using Transaction RZ15.

The above functions are contained in ABAP/4 RFC function modules, which you cancall from the external job scheduling system:

ExternalSystem Management Tool

SystemManagement

-External

Job SchedulingSystem

SAP

XBP Function Module Function BAPI_XBP_JOB...

endfunction

R/3

SynchronousRFC Call

Fig 6.1: How a synchronous RFC function call to XBP works.

6.2 XBP Interface - DescriptionThere follows a short overview of the function modules which make up XBP.Reference information about the modules is given in chapter 7.

The interface can be divided roughly into the following tasks:

23

Defining jobs

Function Modules Short Description

BAPI_XBP_JOB_OPEN Create a job

BAPI_XBP_JOB_ADD_ABAP_STEP Add an ABAP/4 step to an existing job

BAPI_XBP_JOB_ADD_EXTPGM_STEP Add an external program to an existingjob

BAPI_XBP_JOB_CLOSE Finish job creation

Working with jobs

Function Modules Short Description

BAPI_XBP_JOB_ABORT Terminate job

BAPI_XBP_JOB_DELETE Delete a job

Modifying jobs

Function Modules Short Description

BAPI_XBP_JOB_ABAP_STEP_MODIFY Modify an ABAP/4 step

BAPI_XBP_JOB_EXTPGM_STEP_MODIFY Modify an external step

Starting jobs

Function Modules Short Description

BAPI_XBP_JOB_START_ASAP Start as soon as possible

BAPI_XBP_JOB_START_IMMEDIATELY Start immediately or as soon aspossible

Monitoring / Controlling the R/3 job scheduling system

Function Modules Short Description

BAPI_XBP_JOB_CHECK_STATUS Is the job status still correct, is the WPworking?

BAPI_XBP_JOB_COUNT How many jobs exist with a particularname

BAPI_XBP_JOB_SELECT Select sets of jobs by various criteria

BAPI_XBP_JOB_GET_STATUS Read job status

BAPI_XBP_JOB_JOBLOG_READ Read job log

BAPI_XBP_JOB_SPOOLLIST_READ Read spool data

BAPI_XBP_JOB_DEFINITION_GET Read attributes of a job

24

Information about the Background System

Function Modules Short Description

BAPI_XBP_ GET_CURR_BP_RESOURCES Read current background server andwork processes

BAPI_XBP_ GET_DATE_BP_RESOURCES Background work processes at aparticular time

BAPI_XBP_GET_BP_SRVRES_ON_DATE Is there a background work processon server at a particular time?

BAPI_XBP_VARIANT_INFO_GET Does the ABAP/4 program havevariants?

25

7. XBP Reference ManualThis is the reference manual for the interface function modules. Please bear in mindthat the very latest interface parameter types can only be obtained from your system(Transaction SE37, Function Module - interface).

Starting with R/3 release 4.5A instead of using the function modules you can now alsobe accessed as BAPIs. Please note that these methods indicated in the manual for theclasses SystemMngmntSession and BackgroundJob are class methods.

7.1 Requirements For Using The XBP InterfaceThe requirement for using the XBP interface is an existing XMI session. The technicalrequirements (RFC, R/3 Version) are contained in earlier chapters.

7.1.1 Logging On To The R/3 System With An External JobManagement System

Before you call a function module in the XBP interface for the first time, it is importantthat:

• the external job management system logs onto the R/3 System first, using an R/3user name and password. (C function RfcOpen).

• the external job management system is authenticated by the CCMS externalinterface administration using the function module BAPI_XMI_LOGON:

Function name BAPI_XMI_LOGON

Short description Connecting to the external Management Interfaces

Old Name SXMI_LOGON

BAPI class name SystemMngmtSession

BAPI method name Logon

RFC-Interfacefunction BAPI_XMI_LOGONexporting EXTCOMPANY like BAPIXMLOGR_EXTCOMPANY type RFC_CHAR length 16 EXTPRODUCT like BAPIXMLOGR_EXTPRODUCT type RFC_CHAR length 16 INTERFACE like BAPIXMLOGR_INTERFACE type RFC_CHAR length 3 VERSION like BAPIXMLOGR_VERSION type RFC_CHAR length 10importing RETURN structure BAPIRET2 length 540 number of fields 13 SESSIONID like BAPIXMLOGR_SESSIONID type RFC_CHAR length 24

Parameter (Input) • Name of supplier of external management tool

• Product name of external management tool

26

• Interface for logging on.

• Version of the Interface in R/3 expected by the external tool.

Parameter (Output) • SessionId is the ID of the RFC connection

• BAPIRET2 is the return structure for function modules use forBAPIs

MessageIDs • MSG_ALREADY_LOGGED_ON: This product is already loggedonto the interface

• MSG_CANT_LOG: Activity was terminated because the R/3 XMIlogging mechanism returned an error.

• MSG_INVALID_PARAMETERS: EXTCOMPANY andEXTPRODUCT are different within a session.

• MSG_LOGON_DENIED: Logon was denied because the R/3 userused by the external job managements session to log onto the R/3System is not authorized to work with the external jobmanagement system.

• MSG_PROBLEM_DETECTED: XMI problem which cannot befurther specified

• MSG_UNKNOWN_INTERFACE: The interface required by theexternal tool is not supported by the system.

• MSG_UNKNOWN_VERSION: The version required by theexternal tool is not supported by the system.

The logon will only be successful if you assign the following authorization values to theuser for the R/3 authorization object S_XMI_PROD:

• Name of the company which supplies the external job management system

• Program name of the external job management system

• Name of the interface which the user wants to work with

See latest XMI documentation for details on authorization objects and user profiles.

27

7.1.2 External Job Management System - Logging Off

Function name BAPI_XMI_LOGOFF

Short description If you want to end the external job management system’s R/3session, you first need to call the BAPI_XMI_LOGOFF functionmodule.

Old Name SXMI_LOGOFF

BAPI class name SystemMngmtSession

BAPI method name Logoff

RFC-Interface function BAPI_XMI_LOGOFFexporting INTERFACE like BAPIXMLOGR_INTERFACE type RFC_CHAR length 3 RETURN structure BAPIRET2 length 540 number of fields 13 importing

Parameter (Output) • BAPIRET2 is the return structure for function modules use forBAPIs none

MessageIDs • MSG_CANT_LOG: The activity was terminated because the R/3XMI logging mechanism returned an error.

• MSG_NOT_LOGGED_ON: There is no connection with the R/3System.

• MSG_PROBLEM_DETECTED XMI problem which cannot befurther specified

Remarks Afterwards you must close the RFC connection using the C RFCfunction rfcClose.

28

7.2 Defining JobsYou must observe the following procedure in defining R/3 jobs:

• Open job (BAPI_XBP_JOB_OPEN)

• assign (BAPI_XBP_JOB_ADD_ABAP_STEP /BAPI_XBP_JOB_ADD_EXTPGM_STEP) one or more job steps (ABAP/4Programs or external Programs) to the job.

• Close job and assign start time if required ( BAPI_XBP_JOB_CLOSE ).

7.2.1 Job Open

Function name BAPI_XBP_JOB_OPEN

Short description If you want to create a new job, you must first ‘open’ it. When youopen a job, its name is recorded and a job number assigned to it. Thejob name and number are used as a unique key for all subsequentfunction calls.

To open a job you need the following function module:BAPI_XBP_JOB_OPEN.

Old Name SXMI_XBP_JOB_OPEN

BAPI class name BackgroundJob

BAPI method name Open

RFC-Interface function BAPI_XBP_JOB_OPENexporting EXTERNAL_USER_NAME like BAPIXMLOGR_EXTUSER type RFC_CHAR length 16 JOBNAME like BAPIXMJOB_JOBNAME type RFC_CHAR length 32importing JOBCOUNT like BAPIXMJOB_JOBCOUNT Type RFC_CHAR length 8 RETURN structure BAPIRET2 length 540 number of fields 13

Parameter (Output) • JOBCOUNT Job count is the system-generated job number

• BAPIRET2 is the return structure for function modules use forBAPIs

MessageIDs • MSG_JOBNAME_MISSING : You have not entered a job name

• MSG_PROBLEM_DETECTED: The R/3 job scheduling systemhas found an error. You can find an exact description in thesyslog.

• MSG_EXT_USER_MISSING: The name of the external user ismissing. This is the name of a user in the external job schedulingsystem.

• MSG_CANT_LOG: The activity was terminated because the R/3XMI logging mechanism returned an error.

• MSG_NOT_LOGGED_ON: The external management tool hasnot yet logged on to the CCMS XMI interface. The activity cannottherefore be carried out.

29

7.2.2 Assigning an ABAP/4 Program to a Job Step

Function name BAPI_XBP_JOB_ADD_ABAP_STEP

Short description An ABAP/4 program which you intend to run within a job can beassigned to a job step. Enter a valid variant name for the program ifthe ABAP/4 program works with variants.

Old Name SXMI_XBP_ADD_ABAP_STEP

BAPI class name BackgroundJob

BAPI method name AddABAPStep

RFC-Interface function BAPI_XBP_JOB_ADD_ABAP_STEPexporting ABAP_PROGRAM_NAME like BAPIXMREP_REPORTID type RFC_CHAR length 40 ABAP_VARIANT_NAME like BAPIXMREP_VARIANTNAM default SPACE type RFC_CHAR length 14 ARCHIVE_PARAMETERS structure BAPIXMARCH length 23 number of fields 3 EXTERNAL_USER_NAME like BAPIXMLOGR_EXTUSER type RFC_CHAR length 16 JOBCOUNT like BAPIXMJOB_JOBCOUNT type RFC_CHAR length 8 JOBNAME like BAPIXMJOB_JOBNAME type RFC_CHAR length 32 LANGUAGE like BAPIXMSTEP_LANGUAGE default SY-LANGU type RFC_CHAR length 1 PRINT_PARAMETERS structure BAPIXMPRNT length 48 number of fields 12 SAP_USER_NAME like BAPIXMSTEP_AUTHCKNAM default SY-UNAME type RFC_CHAR length 12importing RETURN structure BAPIRET2 length 540 number of fields 13 STEP_NUMBER like BAPIXMJOB_STEPCOUNT type RFC_INT length 4

Parameter (Output) • Number of job steps

• BAPIRET2 is the return structure for function modules use forBAPIs

MessageIDs • MSG_JOBID_MISSING: You did not enter a job name/ jobnumber.

• MSG_JOB_DOES_NOT_EXIST: Job does not exist in the R/3System.

• MSG_PROGRAM_NAME_MISSING: You did not enter an ABAP/4program name

• MSG_PROBLEM_DETECTED: The R/3 job scheduling systemhas found an error. You can find a detailed description in thesyslog.

• MSG_EXT_USER_MISSING: The external user name is missing.This is the name of a user in the external job scheduling system.

• MSG_INVALID_PRINT_PARAMS: Printer entry invalid.

• MSG_INVALID_ARCHIVE_PARAMS: Archiving parametersinvalid

30

• MSG_NO_ARCHIVE_INFO: Archiving information not given.

• MSG_CANT_LOG: Activity was terminated because the R/3 XMIlogging mechanism returned an error.

• MSG_NOT_LOGGED_ON: The external management tool is notlogged onto the CCMS XMI interface. The activity can thereforenot be carried out.

31

7.2.3 Assigning an External Program to a Job Step.

Function name BAPI_XBP_JOB_ADD_EXT_STEP

Short description You can assign a program to a job step which runs outside the R/3System (ex. a C program). Enter the name of the program and that ofthe host on which the external program is to run

Old Name SXMI_XBP_JOB_ADD_EXTPGM_STEP

BAPI class name BackgroundJob

BAPI method name AddExternalStep

RFC-Interface function BAPI_XBP_JOB_ADD_EXT_STEPexporting EXTERNAL_USER_NAME like BAPIXMLOGR_EXTUSER type RFC_CHAR length 16 EXT_PROGRAM_NAME like BAPIXMSTEP_PROGRAM type RFC_CHAR length 128 EXT_PROGRAM_PARAMETERS like BAPIXMSTEP_PARAMETER default SPACE type RFC_CHAR length 255 JOBCOUNT like BAPIXMJOB_JOBCOUNT type RFC_CHAR length 8 JOBNAME like BAPIXMJOB_JOBNAME type RFC_CHAR length 32 SAP_USER_NAME like BAPIXMSTEP_AUTHCKNAM default SY-UNAME type RFC_CHAR length 12 TARGET_HOST like BAPIXMSTEP_XPGTGTSYS type RFC_CHAR length 32 WAIT_FOR_TERMINATION like BAPIXMAUX_CHAR1 default 'X' type RFC_CHAR length 1importing RETURN structure BAPIRET2 length 540 number of fields 13 STEP_NUMBER like BAPIXMJOB_STEPCOUNT type RFC_INT length 4

Parameter (Output) • Number of job steps

• BAPIRET2 is the return structure for function modules use forBAPIs

MessageIDs • MSG_JOBID_MISSING: You did not enter a job name / jobnumber

• MSG_JOB_DOES_NOT_EXIST: Job does not exist in R/3System.

• MSG_PROGRAM_NAME_MISSING: You did not give the nameof the external program

• MSG_TARGET_HOST_MISSING: You did not specify the targethost.

• MSG_PROBLEM_DETECTED: The R/3 job scheduling systemhas discovered a problem. You can find a detailed description inthe syslog.

• MSG_EXT_USER_MISSING: External user name is missing. Thisis the name of a user in the external job scheduling system.

• MSG_CANT_LOG: Activity was terminated because the R/3 XMI

32

logging mechanism returned an error.

• MSG_NOT_LOGGED_ON: The external management tool hasnot logged on to the CCMS XMI interface. The activity cannottherefore be carried out.

33

7.2.4 Close Job Definition

Function name BAPI_XBP_JOB_CLOSE

Short description You close a job definition using the BAPI_XBP_JOB_CLOSE functionmodule.

Old Name SXMI_XBP_JOB_CLOSE

BAPI class name BackgroundJob

BAPI method name Close

RFC-Interface BAPI_XBP_JOB_CLOSEexporting EXTERNAL_USER_NAME like BAPIXMLOGR_EXTUSER type RFC_CHAR length 16 JOBCOUNT like BAPIXMJOB_JOBCOUNT type RFC_CHAR length 8 JOBNAME like BAPIXMJOB_JOBNAME type RFC_CHAR length 32

importing RETURN structure BAPIRET2 length 540 number of fields 13

Parameter (Output) • BAPIRET2 is the return structure for function modules use forBAPIs

MessageIDs • MSG_JOBID_MISSING: You have not entered a job name/ jobnumber.

• MSG_JOB_DOES_NOT_EXIST: Job does not exist in R/3System.

• MSG_PROBLEM_DETECTED: The R/3 job scheduling systemhas discovered an error. You can see a detailed description in thesyslog.

• MSG_EXT_USER_MISSING: Name of external user is missing.This is the name of a user in the external job scheduling system.

• MSG_CANT_LOG: The activity was terminated because the R/3XMI logging system returned an error.

• MSG_NOT_LOGGED_ON: The external management tool hasnot logged on to the CCMS XMI interface. The activity cantherefore not be carried out.

34

7.2.5 Reading Job Definitions from the SAP R/3 System

Function name BAPI_XBP_JOB_DEFINITION_GET

Short description You use the BAPI_XBP_JOB_DEFINITION_GET function module toread all the data associated with a job (name, job class, steps, startdate etc.).

Old Name SXMI_XBP_JOB_DEFINITION_GET

BAPI class name BackgroundJob

BAPI method name GetDefinition

RFC-Interface BAPI_XBP_JOB_DEFINITION_GETexporting EXTERNAL_USER_NAME like BAPIXMLOGR_EXTUSER type RFC_CHAR length 16 JOBCOUNT like BAPIXMJOB_JOBCOUNT type RFC_CHAR length 8 JOBNAME like BAPIXMJOB_JOBNAME type RFC_CHAR length 32importing JOB_HEAD structure BAPIXMJOB length 388 number of fields 35 RETURN structure BAPIRET2 length 540 number of fields 13tables STEP_TBL structure BAPIXMSTEP length 980 number of fields 56

Parameter (Output) • Job header data (name, job class...)

• Table with job step data

• BAPIRET2 is the return structure for function modules use forBAPIs

MessageIDs • MSG_JOBID_MISSING: You have not specified a job name/count

• MSG_JOB_DOES_NOT_EXIST: Job does not exist in R/3System.

• MSG_JOB_DOESNT_HAVE_STEPS: Job does not yet have anysteps. This can occur if a job already exists in the database but nosteps have been assigned to it.

• MSG_PROBLEM_DETECTED: The R/3 job scheduling systemhas discovered an error. You can find a precise description in thesyslog.

• MSG_EXT_USER_MISSING: Name of the external user ismissing. This is the name of a user in the external job schedulingsystem.

• MSG_CANT_LOG: The activity was terminated because the R/3XMI logging mechanism returned an error.

• MSG_NOT_LOGGED_ON: The external management tool hasnot logged onto the CCMS XMI interface. The activity cannottherefore be carried out.

35

7.2.6 Determine Number of Jobs With Particular Job Name

Function name BAPI_XBP_JOB_COUNT

Short description You can use the function module BAPI_XBP_JOB_COUNT todetermine the number of jobs which are defined in the SAP R/3System with a particular job name.

Old Name SXMI_XBP_JOB_COUNT

BAPI class name BackgroundJob

BAPI method name CountByName

RFC-Interface function BAPI_XBP_JOB_COUNT exporting

EXTERNAL_USER_NAME like BAPIXMLOGR_EXTUSER type RFC_CHAR length 16 JOBNAME like BAPIXMJOB_JOBNAME type RFC_CHAR length 32importing NUMBER_OF_JOBS like BAPIXMAUX_INT4 type RFC_INT length 4 RETURN structure BAPIRET2 length 540 number of fields 13tables JOB_TABLE structure BAPIXMJOB length 628 number of fields 57

Parameter (Output) • Job header data (name, job class,...) for jobs found

• Number of jobs found

• BAPIRET2 is the return structure for function modules use forBAPIs

MessageIDs • MSG_JOBNAME_MISSING: You have not specified a job name

• MSG_NO_JOBS_FOUND: No jobs with the given name werefound

• MSG_PROBLEM_DETECTED: The R/3 job scheduling systemhas found an error. You can find a precise description in thesyslog

• MSG_EXT_USER_MISSING: Name of the external user ismissing. This is the name of a user in the external job schedulingsystem

• MSG_CANT_LOG: Activity was terminated because the R/3 XMIlogging mechanism returned an error

• MSG_NOT_LOGGED_ON: The external management tool hasnot logged onto the CCMS XMI interface. The activity cannottherefore be carried out.

36

7.2.7 Selecting Jobs

Function name BAPI_XBP_JOB_SELECT

Short description You can use the function module BAPI_XBP_JOB_SELECT to selecta set of jobs in the SAP R/3 System that match the selection criteriagiven. At least the username and the jobname must be partly (usingwildcards) specified.

Old Name <new function to XBP 1.0>

BAPI class name BackgroundJob

BAPI method name Select

RFC-Interface function BAPI_XBP_JOB_SELECT exporting EXTERNAL_USER_NAME like BAPIXMLOGR_EXTUSER type RFC_CHAR length 16 JOB_SELECT_PARAM structure BAPIXMJSEL length 196 number of fields 18 importing RETURN structure BAPIRET2 length 548 number of fields 14 tables SELECTED_JOBS structure BAPIXMJOBS length 40 number of fields 2

Parameter (Output) • Minimal job header (name and count) for selected jobs

• BAPIRET2 is the return structure for function modules use forBAPIs

MessageIDs • MSG_INVALID_SELECT_OPTION: You have not specified selectoptions correctly

• MSG_SELECT_JOBNAME_MISSING: You have not specified ajob name

• MSG_SELECT_USERNAME_MISSING: You have not specified auser name

• MSG_NO_JOBS_FOUND: No jobs with the given name werefound

• MSG_PROBLEM_DETECTED: The R/3 job system has found anerror. You can find a precise description in the syslog

• MSG_EXT_USER_MISSING: Name of the external user ismissing. This is the name of a user in the external job schedulingsystem

• MSG_CANT_LOG: Activity was terminated because the R/3 XMIlogging mechanism returned an error

• MSG_NOT_LOGGED_ON: The external management tool hasnot logged onto the CCMS XMI interface. The activity cannottherefore be carried out.

37

7.3 Starting a JobYou start a job using the XBP interface in the R/3 System with the start time type ‘startimmediately’. Use the following function modules to do this:

• Start job immediately (BAPI_XBP_JOB_START_IMMEDIATELY)

• Start job as soon as possible (BAPI_XBP_JOB_ASAP).

7.3.1 Start Job Immediately

Function name BAPI_XBP_JOB_START_IMMEDIATELY

Short description This function attempts to start a job immediately. If the job cannot bestarted immediately because, for example, all background workprocesses are busy, the function reports this to its caller.

Old Name SXMI_XBP_JOB_START_IMMEDIATELY

BAPI class name BackgroundJob

BAPI method name StartImmediately

RFC-Interface function BAPI_XBP_JOB_START_IMMEDIATELYexporting EXTERNAL_USER_NAME like BAPIXMLOGR_EXTUSER type RFC_CHAR length 16 JOBCOUNT like BAPIXMJOB_JOBCOUNT type RFC_CHAR length 8 JOBNAME like BAPIXMJOB_JOBNAME type RFC_CHAR length 32TARGET_SERVER like BAPIXMJOB_EXECSERVER type RFC_CHAR length 20importing RETURN structure BAPIRET2 length 540 number of fields 13

Parameter (Output) • BAPIRET2 is the return structure for function modules use forBAPIs

MessageIDs • MSG_JOBID_MISSING: You did not enter a job name/ jobnumber

• MSG_JOB_DOES_NOT_EXIST: Job does not exist in the R/3System.

• MSG_PROBLEM_DETECTED: The R/3 job scheduling systemdiscovered an error. You can find a precise description in thesyslog.

• MSG_NO_IMMEDIATE_START_POSS: Job cannot be startedimmediately, since no background work processes are free. Notethat the Job is not released in this case and is therefore notwaiting to run inside the system.

• MSG_NO_EXECUTE_PRIVILEGE: The R/3 user with which theexternal job management system logged on to the R/3 System, isnot authorized to release the job.

• MSG_EXT_USER_MISSING: External user name is missing. Thisis the name of a user in the external job scheduling system.

• MSG_CANT_LOG: Activity was terminated because the R/3 XMIlogging mechanism returned an error.

38

• NOT_LOGGED_ON: The external management tool has notlogged on to the CCMS XMI interface. The activity cannottherefore be carried out.

39

7.3.2 Start Job As Soon As PossibleUnlike the BAPI_XBP_JOB_START_IMMEDIATELY function, no error isreturned if the job cannot be started immediately.

Function name BAPI_XBP_JOB_START_ASAP

Short description You use this function to start a job as soon as possible. You canspecifiy the application server this job should be targeted for.

Old Name SXMI_XBP_JOB_START_ASAP

BAPI class name BackgroundJob

BAPI method name StartAsSoonAsPossible

RFC-Interface function BAPI_XBP_JOB_START_ASAPexporting EXTERNAL_USER_NAME like BAPIXMLOGR_EXTUSER type RFC_CHAR length 16 JOBCOUNT like BAPIXMJOB_JOBCOUNT type RFC_CHAR length 8 JOBNAME like BAPIXMJOB_JOBNAME type RFC_CHAR length 32 TARGET_SERVER like BAPIXMJOB_EXECSERVER type RFC_CHAR length 20importing RETURN structure BAPIRET2 length 540 number of fields 13

Parameter (Output) • BAPIRET2 is the return structure for function modules use forBAPIs

MessageIDs • MSG_JOBID_MISSING: You did not enter a job name/ count

• MSG_JOB_DOES_NOT_EXIST: Job does not exist in the R/3System.

• MSG_PROBLEM_DETECTED: The R/3 job scheduling systemfound an error. You can find a precise description in the syslog.

• MSG_NO_RELEASE_PRIVILEGE: The R/3 user with which theexternal job management system logged onto the R/3 System isnot authorized to release the job.

• MSG_EXT_USER_MISSING: Name of the external user ismissing. This is the name of a user in the external job schedulingsystem.

• MSG_CANT_LOG: Activity was terminated because the R/3 XMIlogging mechanism returned an error.

• MSG_NOT_LOGGED_ON: The external management tool hasnot logged on to the CCMS XMI interface. The activity cannottherefore be carried out.

40

7.4 Modifying Steps in a JobThere are two functions which you can use to modify job steps containing ABAP/4 or externalprograms, namely:

• BAPI_XBP_ABAP_STEP_MODIFYto modify a job step containing an ABAP/4 program

and

• BAPI_XBP_EXTPGM_STEP_MODIFYto modify a job step containing an external program.

7.4.1 Modifying a Job Step Containing an ABAP/4 Program

Function name BAPI_XBP_JOB_ABAP_STEP_MODIFY

Short description modify a job step containing an ABAP/4 program

Old Name SXMI_XBP_JOB_ABAP_STEP_MODIFY

BAPI class name BackgroundJob

BAPI method name ModifyABAPStep

RFC-Interface function BAPI_XBP_JOB_ABAP_STEP_MODIFYexporting ABAP_PROGRAM_NAME like BAPIXMREP_REPORTID type RFC_CHAR length 40 ABAP_VARIANT_NAME like BAPIXMREP_VARIANTNAM default SPACE type RFC_CHAR length 14 ARCHIVE_PARAMETERS structure BAPIXMARCH length 23 number of fields 3 EXTERNAL_USER_NAME like BAPIXMLOGR_EXTUSER type RFC_CHAR length 16 JOBCOUNT like BAPIXMJOB_JOBCOUNT type RFC_CHAR length 8 JOBNAME like BAPIXMJOB_JOBNAME type RFC_CHAR length 32 LANGUAGE like BAPIXMSTEP_LANGUAGE default SY-LANGU type RFC_CHAR length 1 PRINT_PARAMETERS structure BAPIXMPRNT length 48 number of fields 12 SAP_USER_NAME like BAPIXMSTEP_AUTHCKNAM default SY-UNAME type RFC_CHAR length 12 STEP_NUMBER like BAPIXMJOB_STEPCOUNT type RFC_INT length 4

importing RETURN structure BAPIRET2 length 540 number of fields 13

Parameter (Output) • BAPIRET2 is the return structure for function modules use forBAPIs

MessageIDs • MSG_JOBID_MISSING: You did not enter a job name/ number.

• MSG_JOB_DOES_NOT_EXIST: Job does not exist in the R/3System.

• MSG_STEP_COUNT_MISSING: You did not enter the number ofthe step to be modified.

• MSG_INVALID_STEP_COUNT: Step number invalid, i.e. there isno step with the given number.

41

• MSG_EXT_USER_MISSING: Name of the external user ismissing. This is the name of a user in the external job schedulingsystem.

• MSG_PROGRAM_NAME_MISSING: The ABAP/4 program nameis missing.

• MSG_PROBLEM_DETECTED: The R/3 job scheduling systemhas discovered an error. You can find a precise description in thesyslog.

• MSG_CANT_LOG: The activity was terminated because the R/3XMI logging mechanism returned an error.

• MSG_NOT_LOGGED_ON: The external management tool hasnot logged onto the CCMS XMI interface. The activity cannottherefore be carried out.

Note The type of the language specifier will most likely be modified in R/3

Release 4.0

42

7.4.2 Modifying a Job Step Containing an External Program

Function name BAPI_XBP_JOB_EXT_STEP_MODIFY

Short description To modify a job step containing an external program.

Old Name SXMI_XBP_JOB_EXTPGM_STEP_MODIFY

BAPI class name BackgroundJob

BAPI method name ModifyExternalStep

RFC-Interface function BAPI_XBP_JOB_EXT_STEP_MODIFYexporting EXTERNAL_USER_NAME like BAPIXMLOGR_EXTUSER type RFC_CHAR length 16 EXT_PROGRAM_NAME like BAPIXMSTEP_PROGRAM type RFC_CHAR length 128 EXT_PROGRAM_PARAMETERS like BAPIXMSTEP_PARAMETER default SPACE type RFC_CHAR length 255 JOBCOUNT like BAPIXMJOB_JOBCOUNT type RFC_CHAR length 8 JOBNAME like BAPIXMJOB_JOBNAME type RFC_CHAR length 32 SAP_USER_NAME like BAPIXMSTEP_AUTHCKNAM default SY-UNAME type RFC_CHAR length 12 STEP_NUMBER like BAPIXMJOB_STEPCOUNT type RFC_INT length 4 TARGET_HOST like BAPIXMSTEP_XPGTGTSYS type RFC_CHAR length 32 WAIT_FOR_TERMINATION like BAPIXMAUX_CHAR1 default 'X' type RFC_CHAR length 1importing RETURN structure BAPIRET2 length 540 number of fields 13

Parameter (Output) • BAPIRET2 is the return structure for function modules use forBAPIs

MessageIDs • MSG_JOBID_MISSING: You did not enter a job name/ number.

• MSG_JOB_DOES_NOT_EXIST: Job does not exist in the R/3System.

• MSG_STEP_COUNT_MISSING: You did not specify the numberof the step to be modified

• MSG_INVALID_STEP_COUNT: The step number is invalid, i.e.there is no step with the given number.

• MSG_PROGRAM_NAME_MISSING: The name of the externalprogram is missing.

• MSG_PROBLEM_DETECTED: The R/3 job scheduling systemhas discovered an error. You can find precise information in thesyslog.

• MSG_EXT_USER_MISSING: Name of the external user ismissing. This is the name of a user in the external job schedulingsystem.

• MSG_CANT_LOG: Activity was terminated because the R/3 XMIlogging mechanism returned an error.

• MSG_NOT_LOGGED_ON: The external management tool has

43

not logged onto the CCMS XMI interface. The activity cannottherefore be carried out.

44

7.5 Finding Job Monitor DataUsing an external job management system you can also monitor SAP R/3 jobs anddisplay job logs and spool lists. These can be done using the following functionmodules:

• BAPI_XBP_JOB_STATUS_GET , to determine the status of a job

• BAPI_XBP_JOB_JOBLOG_READ , to read the job log of a job

• BAPI_XBP_JOB_SPOOLLIST_READ , to read spool lists from a job

• BAPI_XBP_JOB_STATUS_CHECK , to check the status of a job

• BAPI_XBP_CURRENT_RESOURCES_GET , to determine the currentbackground processing resources in the R/3 System.

7.5.1 Determining the Status of a Job

Function name BAPI_XBP_JOB_STATUS_GET

Short description Determine status of a job by reading R/3 info on job.

Old Name SXMI_XBP_JOB_STATUS_GET

BAPI class name BackgroundJob

BAPI method name GetStatus

RFC-Interface function BAPI_XBP_JOB_STATUS_GETexporting EXTERNAL_USER_NAME like BAPIXMLOGR_EXTUSER type RFC_CHAR length 16 JOBCOUNT like BAPIXMJOB_JOBCOUNT type RFC_CHAR length 8 JOBNAME like BAPIXMJOB_JOBNAME type RFC_CHAR length 32

importing RETURN structure BAPIRET2 length 540 number of fields 13 STATUS like BAPIXMJOB_STATUS type RFC_CHAR length 1

Parameter (Output) • Job status

Possible values for the status of a job'R' - active'Y' - ready'P' - scheduled'S' - released'A' - terminated'F' - finished

• BAPIRET2 is the return structure for function modules use forBAPIs

MessageIDs • MSG_JOBID_MISSING: You did not specify a job name/ number

• MSG_PROBLEM_DETECTED: The R/3 job scheduling systemhas discovered an error. You can find a precise description in thesyslog.

• MSG_JOB_DOES_NOT_EXIST: Job does not exist in the R/3System.

45

• MSG_CANT_LOG: Activity was terminated because the R/3 XMIlogging mechanism returned an error.

• MSG_EXT_USER_MISSING: Name of the external user ismissing. This is the name of a user in the external job schedulingsystem.

• MSG_NOT_LOGGED_ON: The external management tool hasnot logged onto the CCMS XMI interface. The activity cannottherefore be carried out.

46

7.5.2 Read Job Log

Function name BAPI_XBP_JOB_JOBLOG_READ

Short description Get joblog (also called job protocol) for a particular job.

Old Name SXMI_XBP_JOB_JOBLOG_READ

BAPI class name BackgroundJob

BAPI method name ReadJoblog

RFC-Interface function BAPI_XBP_JOB_JOBLOG_READexporting EXTERNAL_USER_NAME like BAPIXMLOGR_EXTUSER type RFC_CHAR length 16 JOBCOUNT like BAPIXMJOB_JOBCOUNT type RFC_CHAR length 8 JOBNAME like BAPIXMJOB_JOBNAME type RFC_CHAR length 32 importing RETURN structure BAPIRET2 length 540 number of fields 13 tables JOB_PROTOCOL structure BAPIXMPROT length 572 number of fields 14

Parameter (Output) • Table containing the job log

• BAPIRET2 is the return structure for function modules use forBAPIs

MessageIDs • MSG_JOBID_MISSING: You have not entered a job name/ count.

• MSG_JOB_DOES_NOT_EXIST: Job does not exist in the R/3System.

• MSG_EXT_USER_MISSING: Name of the external user ismissing. This is the name of a user in the external job schedulingsystem.

• MSG_NO_PRIVILEGE_GIVEN: The SAP R/3 user used by theexternal management system to log onto the R/3 System, is notauthorized to read the job log.

• MSG_PROBLEM_DETECTED: The R/3 job scheduling systemhas discovered an error. You can find a precise description in thesyslog.

• MSG_NO_JOB_PROTOCOL: A log does not yet exist for thespecified job.

• MSG_NO_JOB_PROTOCOL: The job log listed in the job headerdata no longer exists. It was probably deleted at operating systemlevel.

• MSG_JOB_PROTOCOL_IS_EMPTY: Job log is empty.

• MSG_CANT_LOG: The activity was terminated because the R/3XMI logging mechanism returned an error.

• MSG_NOT_LOGGED_ON: The external management tool hasnot logged onto the CCMS XMI interface. The activity cannottherefore be carried out.

Note

47

1. The format of the joblog (MsgId) has changed in R/3 Release 4.02. The term job protocol was common for what is now known as

joblog.Don’t get confused. It is the same thing but the correct termis JOBLOG

48

7.5.3 Read the Spool List of a Job

Function name BAPI_XBP_JOB_SPOOLLIST_READ

Short description Read spoollist of a job that has been run.

Old Name SXMI_XBP_JOB_SPOOLLIST_READ

BAPI class name BackgroundJob

BAPI method name ReadSpoollist

RFC-Interface function BAPI_XBP_JOB_SPOOLLIST_READexporting EXTERNAL_USER_NAME like BAPIXMLOGR_EXTUSER type RFC_CHAR length 16 JOBCOUNT like BAPIXMJOB_JOBCOUNT type RFC_CHAR length 8 JOBNAME like BAPIXMJOB_JOBNAME type RFC_CHAR length 32 STEP_NUMBER like BAPIXMJOB_STEPCOUNT type RFC_INT length 4 importing RETURN structure BAPIRET2 length 540 number of fields 13 tables SPOOL_LIST structure BAPIXMSPOO length 255 number of fields 1

Parameter (Output) • internal table containing spool list

• BAPIRET2 is the return structure for function modules use forBAPIs

MessageIDs • MSG_JOBID_MISSING: You have not entered a job name/number

• MSG_JOB_DOES_NOT_EXIST: Job does not exist in the R/3System.

• MSG_JOB_DOESNT_HAVE_STEPS: Job has no steps.

• MSG_INVALID_STEP_COUNT: The job does not contain a stepwith the given number.

• MSG_STEP_COUNT_MISSING: No step number was specified.

• MSG_NO_SPOOLLIST: The specified step has no spool list.

• MSG_INVALID_SPOOLID: The spool ID contained in the step isinvalid.

• MSG_NO_SPOOLLIST: The spool request belonging to the stepdoes not contain an ABAP/4 list. The spool request cannot bedisplayed.

• MSG_EXT_USER_MISSING: The name of the external user ismissing. This is the name of a user in the external job schedulingsystem.

• MSG_NO_PRIVILEGE_GIVEN: The user used by the externalmanagement system to log onto the R/3 System is not authorizedto read the spool list.

• MSG_PROBLEM_DETECTED: The R/3 job scheduling systemhas discovered an error. You can find a precise description in thesyslog.

49

• MSG_CANT_LOG: The activity was terminated because the R/3XMI logging mechanism returned an error.

• MSG_NOT_LOGGED_ON: The external management tool hasnot logged onto the CCMS XMI interface. The activity cannottherefore be carried out.

50

7.5.4 Checking the Status of a JobProblems with the R/3 System (Database, network, termination of background workprocesses) can cause discrepancies between the actual status of a job and its recordedstatus in the database.

Example

A background work process, with an active job, is terminated manually. The jobruntime system cannot set the job status in the database to ‘terminated’.

The function module BAPI_XBP_JOB_STATUS_CHECK recognizes these cases andcorrects the job status accordingly.

Function name BAPI_XBP_JOB_STATUS_CHECK

Short description Check whether the internally displayed status is up to date.

Old Name SXMI_XBP_JOB_STATUS_CHECK

BAPI class name BackgroundJob

BAPI method name CheckStatus

RFC-Interface function BAPI_XBP_JOB_STATUS_CHECKexporting EXTERNAL_USER_NAME like BAPIXMLOGR_EXTUSER type RFC_CHAR length 16 JOBCOUNT like BAPIXMJOB_JOBCOUNT type RFC_CHAR length 8 JOBNAME like BAPIXMJOB_JOBNAME type RFC_CHAR length 32importing ACTUAL_STATUS like BAPIXMJOB_STATUS type RFC_CHAR length 1 RETURN structure BAPIRET2 length 540 number of fields 13 STATUS_ACCORDING_TO_DB like BAPIXMJOB_STATUS type RFC_CHAR length 1

Parameter (Output) • Job status according to the database

• Actual job status

Possible values for job status:'R' - active'Y' - ready'P' - scheduled'S' - released'A' - terminated'F' - finished‘X‘ - actual status cannot be determined

• BAPIRET2 is the return structure for function modules use forBAPIs

MessageIDs • MSG_JOBID_MISSING: You did not specify a job name/ number

• MSG_JOB_DOES_NOT_EXIST: Job does not exist in the R/3System.

• MSG_EXT_USER_MISSING: Name of the external user ismissing. This is the name of a user in the external job schedulingsystem.

• MSG_PROBLEM_DETECTED: The R/3 job scheduling system

51

has discovered an error. You can find a precise description in thesyslog.

• MSG_NO_PRIVILEGE_GIVEN: The SAP user used by theexternal job management system to log onto the R/3 System isnot authorized to use this function.

• MSG_CANT_LOG: The activity was terminated because the R/3XMI logging mechanism returned an error.

• MSG_NOT_LOGGED_ON: The external management tool hasnot logged onto the CCMS XMI interface. The activity cannottherefore be carried out.

52

7.6 Controlling JobsControl functions currently include termination of active jobs and deleting obsolete – not running- jobs.

7.6.1 Aborting a JobYou can terminate an active job using the function module BAPI_JOB_ABORT.

Function name BAPI_XBP_JOB_ABORT

Short description Abort a running job.

Old Name SXMI_XBP_JOB_ABORT

BAPI class name BackgroundJob

BAPI method name Abort

RFC-Interface function BAPI_XBP_JOB_ABORTexporting EXTERNAL_USER_NAME like BAPIXMLOGR_EXTUSER type RFC_CHAR length 16 JOBCOUNT like BAPIXMJOB_JOBCOUNT type RFC_CHAR length 8 JOBNAME like BAPIXMJOB_JOBNAME type RFC_CHAR length 32importing RETURN structure BAPIRET2 length 540 number of fields 13

Parameter (Output) • BAPIRET2 is the return structure for function modules use forBAPIs

MessageIDs • MSG_JOBID_MISSING: You did not enter a job name / number.

• MSG_JOB_DOES_NOT_EXIST: Job does not exist in the R/3System.

• MSG_EXT_USER_MISSING: The name of the external user ismissing. This is the name of a user in the external job schedulingsystem.

• MSG_JOB_NOT_ACTIVE: The job cannot be terminated since itis not active.

• MSG_NO_PRIVILEGE_GIVEN: The SAP R/3 user used by theexternal job management system to log onto the R/3 System isnot authorized to terminate the job.

• MSG_PROBLEM_DETECTED: The R/3 job scheduling systemhas discovered an error. You can find a precise description in thesyslog.

• MSG_CANT_LOG: The activity was terminated because the R/3XMI logging mechanism returned an error.

• MSG_NOT_LOGGED_ON: The external management tool hasnot logged onto the CCMS XMI interface. The activity cannottherefore be carried out.

53

7.6.2 Deleting a Job

Function name BAPI_XBP_JOB_DELETE

Short description Delete a - not running - job.

Old Name <new function to XBP 1.0>

BAPI class name BackgroundJob

BAPI method name Delete

RFC-Interface function BAPI_XBP_JOB_DELETEexporting EXTERNAL_USER_NAME like BAPIXMLOGR_EXTUSER type RFC_CHAR length 16 JOBCOUNT like BAPIXMJOB_JOBCOUNT type RFC_CHAR length 8 JOBNAME like BAPIXMJOB_JOBNAME type RFC_CHAR length 32importing RETURN structure BAPIRET2 length 540 number of fields 13

Parameter (Output) • BAPIRET2 is the return structure for function modules use forBAPIs

MessageIDs • MSG_JOBID_MISSING: You did not enter a job name / number.

• MSG_JOB_DOES_NOT_EXIST: Job does not exist in the R/3System.

• MSG_EXT_USER_MISSING: The name of the external user ismissing. This is the name of a user in the external job schedulingsystem.

• MSG_JOB_RUNNING: The job cannot be terminated since it iscurrently active.

• MSG_NO_DELETE_PRIVILEGE: The SAP R/3 user used by theexternal job management system to log onto the R/3 System isnot authorized to delete the job.

• MSG_ CANT_DEL_IN_JOBTABLE: While trying to delete the jobone of the tables that contains job data entries can not be deleted.

• MSG_CANT_DEL_JOBLOG: Failed to find or delete the joblog ofthe specified job. Deleting the job continues.

• MSG_PROBLEM_PRED_SUCC: A problem with the handling ofthe predecessor or successor of the deleted job occured.

• MSG_PROBLEM_DETECTED: The R/3 job scheduling systemhas discovered an error. You can find a precise description in thesyslog.

• MSG_CANT_LOG: The activity was terminated because the R/3XMI logging mechanism returned an error.

• MSG_NOT_LOGGED_ON: The external management tool hasnot logged onto the CCMS XMI interface. The activity cannottherefore be carried out.

54

7.7 General Help FunctionsBelow are descriptions of the following functions which allow you to:

• see all variants of a given ABAP/4 program(BAPI_XBP_VARIANT_INFO_GET).

• see the resources currently available for jobs in the R/3 System(BAPI_XBP_ CURRENT_RESOURCES_GET).

• determine whether resources are available for a job on a particular server at aparticular time (BAPI_XBP_ SRV_RES_ON_DATE_GET).

• determine whether resources are available for a job on any server in the R/3System at a particular time (BAPI_XBP_RESOURCES_ON_DATE_GET).

• read syslog entries in the R/3 System.

7.7.1 Show All Defined Variants of an ABAP/4 Program

Function name BAPI_XBP_VARIANT_INFO_GET

Short description For a given ABAP the variants are read.

Old Name SXMI_XBP_VARIANT_INFO_GET

BAPI class name BackgroundJob

BAPI method name GetVariantListForReportname

RFC-Interface function BAPI_XBP_VARIANT_INFO_GETexporting ABAP_PROGRAM_NAME like BAPIXMREP_REPORTID type RFC_CHAR length 40 EXTERNAL_USER_NAME like BAPIXMLOGR_EXTUSER type RFC_CHAR length 16 VARIANT_SELECT_OPTION likeBAPIXMREP_VARSELOPT type RFC_CHAR length 1importing RETURN structure BAPIRET2 length 540 number of fields 13tables ABAP_VARIANT_TABLE structure BAPIXMVAR length 54 number of fields 2

Parameter (Input) • Meaning of parameter VARIANT_SELECT_OPTION

'A' - variants that are available for batch as well as for dialogwill be selected'B' - ‘batch only’ variants will be selected

Parameter (Output) • Table containing all defined variants of the ABAP/4 program

• BAPIRET2 is the return structure for function modules use forBAPIs

MessageIDs • MSG_PROGRAM_DOES_NOT_EXIST: The specified ABAPprogram does not exist in the R/3 System.

• MSG_INVALID_SELECT_OPTION: wrong code used to selectvariants of an ABAP.

• MSG_PROGRAM_HAS_NO_VARIANT: The ABAP program has

55

no variants.

• MSG_NO_VARIANTS_DEFINED: You have not yet defined anyvariants.

• MSG_PROG_NOT_EXECUTABLE: The program is notexecutable.

• MSG_NO_EXECUTE_PRIVILEGE: The SAP user used by theexternal job management system to log onto the R/3 System isnot authorized to execute the ABAP/4 program.

• MSG_PROBLEM_DETECTED: The R/3 job scheduling systemhas discovered an error. You can find a precise description in thesyslog.

• MSG_CANT_LOG: The activity was terminated because the R/3XMI logging mechanism returned an error.

• MSG_EXT_USER_MISSING: The name of the external user ismissing. This is the name of a user in the external job schedulingsystem

• MSG_NOT_LOGGED_ON: The external management tool hasnot logged onto the CCMS XMI interface. The activity cannottherefore be carried out.

56

7.7.2 Determine Current Resources for Jobs in the R/3System

Function name BAPI_XBP_GET_CURR_BP_RESOURCES

Short description Using this function module you can retrieve the following valuesfrom the R/3 System:

• Names of the servers which currently have background workprocesses

• Number of background work processes on each server andtheir status (total number, free, working, class A backgroundwork processes).

Old Name SXMI_XBP_GET_CURR_BP_RESOURCES

BAPI class name SystemServiceInfo

BAPI method name GetCurrentBackgroundResources

RFC-Interface function BAPI_XBP_GET_CURR_BP_RESOURCESexporting EXTERNAL_USER_NAME like BAPIXMLOGR_EXTUSER type RFC_CHAR length 16importing RETURN structure BAPIRET2 length 540 number of fields 13

tables RESOURCE_INFO structure BAPIXMCRES length 69 number of fields 5

Parameter (Output) • Table, containing the following information in each line:

Server name

Host name

Total number of background work processes on the server

Number of free background work processes on the server

Number of working background work processes on the server

Number of reserved class A background work processes on theserver

• BAPIRET2 is the return structure for function modules use forBAPIs

MessageIDs • MSG_PROBLEM_DETECTED: The R/3 job scheduling systemhas discovered an error. You can find a precise description in thesyslog.

• MSG_NO_RESOURCES_FOUND: There are no backgroundprocessing resources in the R/3 System.

• MSG_CANT_LOG: The activity was terminated because the R/3XMI logging mechanism returned an error.

• MSG_EXT_USER_MISSING: The name of the external user ismissing. This is the name of a user in the external job schedulingsystem.

• MSG_NOT_LOGGED_ON: The external management tool hasnot logged onto the CCMS XMI interface. The activity could

57

therefore not be carried out.

58

7.7.3 Check Available Job Resources at a Particular Time ona Server

In the R/3 System, within the framework of switching operation modes on servers, youcan assign different work process types at different times. For example, you might onlyhave dialog processes during the day, but at night some of these switch to operating asbackground work processes. You can use the function moduleBAPI_XBP_SRV_RES_ON_DATE to determine whether background work processesare available at a particular time on a particular server.

Function name BAPI_XBP_GET_BP_SRVRES_ON_DATE

Short description Get resource information for a particular server at a certain date andtime.

Old Name SXMI_XBP_SRV_RES_ON_DATE_GET

BAPI class name SystemServiceInfo

BAPI method name GetBgrdResourcesOnDateOnServer

RFC-Interface function BAPI_XBP_GET_BP_SRVRES_ON_DATEexporting DATE like BAPIXMJOB_SDLSTRTDT type RFC_DATE length 8 EXTERNAL_USER_NAME like BAPIXMLOGR_EXTUSER type RFC_CHAR length 16 SERVER_NAME like BAPIXMJOB_EXECSERVER type RFC_CHAR length 20 TIME like BAPIXMJOB_SDLSTRTTM type RFC_TIME length 6importing RESOURCE_INFO structure BAPIXMRES length 66 number of fields 4 RETURN structure BAPIRET2 length 540 number of fields 13

Parameter (Output) • Table with

Host name

Number of background work processes

Number of reserved class A background work processes

• BAPIRET2 is the return structure for function modules use forBAPIs

MessageIDs • MSG_NO_RESOURCES_FOUND: There are no background workprocesses on the server at the given time and date.

• MSG_PROBLEM_DETECTED: The R/3 job scheduling systemhas discovered a problem. You can find a precise description inthe syslog.

• MSG_INVALID_SERVER_NAME: The specified server name isinvalid

• MSG_INVALID_DATE_TIME: The specified date and/or time isinvalid

• MSG_CANT_LOG: The activity was terminated because the R/3XMI logging mechanism returned an error.

• MSG_EXT_USER_MISSING: The name of the external user ismissing. This is the name of a user in an external job scheduling

59

system.

• MSG_NOT_LOGGED_ON: The external management tool hasnot logged onto the CCMS XMI interface. The activity cannottherefore be carried out.

Note

The XMI log does not record any calls to this function, since it does not changeor output any security-sensitive data.

60

7.7.4 Check Available Job Resources at a Particular Time inthe Whole R/3 System.

Function name BAPI_XBP_GET_BP_RESRC_ON_DATE

Short description You can use this function module to determine whether backgroundwork processes are available at a particular time on any server in theR/3 System.

Old Name SXMI_XBP_RESOURCES_ON_DATE_GET

BAPI class name SystemServiceInfo

BAPI method name GetBackgroundResourcesOnDate

RFC-Interface function BAPI_XBP_GET_BP_RESRC_ON_DATEexporting DATE like BAPIXMJOB_SDLSTRTDT type RFC_DATE length 8 EXTERNAL_USER_NAME like BAPIXMLOGR_EXTUSER type RFC_CHAR length 16 TIME like BAPIXMJOB_SDLSTRTTM type RFC_TIME length 6importing RETURN structure BAPIRET2 length 540 number of fields 13tables RESOURCE_INFO_TBL structure BAPIXMRES length 66 number of fields 4

Parameter (Output) • Table containing the following values:

Server name

Host name

Number of background work processes

Number of reserved class A background work processes

• BAPIRET2 is the return structure for function modules use forBAPIs

MessageIDs • MSG_NO_RESOURCES_FOUND: There are no background workprocesses in the R/3 System at the given time and date.

• MSG_INVALID_DATE_TIME: The specified time and/ or date isinvalid.

• MSG_PROBLEM_DETECTED: The job scheduling system hasdiscovered an error. You can find a precise description in thesyslog.

• MSG_CANT_LOG: The activity was terminated because the R/3XMI logging system returned an error.

• MSG_EXT_USER_MISSING: The name of the external user ismissing. This is the name of a user in the external job schedulingsystem.

• MSG_NOT_LOGGED_ON: The external management tool hasnot logged onto the CCMS XMI interface. The activity cannottherefore be carried out.

61

8. Appendix

The following function module is a part of the XMB interface. As it is important for all ofthe interfaces to be able to find out whether an entry has been generated in the syslog,we have shown here that it is possible to read the R/3 syslog from outside. Pleaserefer to the XMB interface documentation for further monitoring functions of externalsystem management tools

8.1.1 The BAPI Return Structure

For our purposes the Message ID is always ‘XM’ the message number are refered to inthe descriptions above. Parameters are not relevant in our context so far.

Structure BAPIRET2

Field name Type Short description

TYPE

ID

NUMBER

MESSAGE

LOG_NO

LOG_MSG_NO

MESSAGE_V1

MESSAGE_V2

MESSAGE_V3

MESSAGE_V4

PARAMETER

ROW

FIELD

CHAR 1

CHAR 20

NUMC 3

CHAR 220

CHAR 20

NUMC 6

CHAR 50

CHAR 50

CHAR 50

CHAR 50

INT

CHAR 30

Messagetyp: S Success, E Error ...

Message-ID

Message-Number

Message Text

Appication-Log: Protocol Number

Application-Log: actual Number

Message-Variable

Message-Variable

Message-Variable

Message-Variable

Parameter Name

Line in Parameter

Field in Parameter

Notes − This structure is used for all BAPIs and is notrelated to XBP directly

Related to − There have been older structures with differentnames such as: BAPIRETURN1

− −

8.1.2 Message IDs and there meaningIn this version of XBP the Messages IDs as part of the BAPIRET2 structure are usedinstead of MessageIDs used in version 0.1.

62

You will be able to see the actual text of the message once you analyse the BAPIRET2values. For your convenience we include here the constants which are referenced inthe function module descriptions.

msg_already_logged_on_gen like sy-msgno value '021',

msg_already_logged_on like sy-msgno value '022',

msg_unknown_interface like sy-msgno value '023',

msg_unknown_version like sy-msgno value '024',

msg_logon_denied like sy-msgno value '025',

msg_logon_denied like sy-msgno value '026',

msg_not_logged_on like sy-msgno value '027',

msg_not_logged_on like sy-msgno value '028',

msg_invalid_range like sy-msgno value '029',

msg_cant_select like sy-msgno value '030',

msg_cant_log like sy-msgno value '031',

msg_cant_upload like sy-msgno value '032',

msg_invalid_parameters like sy-msgno value '033',

msg_problem_detected like sy-msgno value '034',

msg_reorg_gen like sy-msgno value '037',

msg_reorg like sy-msgno value '035',

msg_jobname_missing like sy-msgno value '046',

msg_jobid_missing like sy-msgno value '047',

msg_ext_user_missing like sy-msgno value '048',

msg_job_does_not_exist like sy-msgno value '049',

msg_progname_missing like sy-msgno value '050',

msg_no_archive_info like sy-msgno value ‘051’

msg_invalid_print_params like sy-msgno value '052',

msg_invalid_archive_params like sy-msgno value '053',

msg_no_release_privileg like sy-msgno value '054',

msg_job_not_active like sy-msgno value '055',

msg_no_abort_privilege like sy-msgno value '056',

msg_no_job_found like sy-msgno value '057',

msg_targethost_missing like sy-msgno Value ‘058’

msg_no_jobsteps like sy-msgno value '059',

msg_no_job_protocol like sy-msgno value '060',

msg_empty_job_protocol like sy-msgno value '061',

msg_step_count_missing like sy-msgno value '062',

msg_no_spoollist like sy-msgno value '063',

msg_privilege_missing like sy-msgno value '064',

msg_invalid_spoolid like sy-msgno value '065',

msg_no_immediate_start_poss like sy-msgno value '066',

msg_no_resources_found like sy-msgno value '067',

63

msg_invalid_date_time like sy-msgno value '068',

msg_invalid_server_name like sy-msgno value '069',

msg_prog_has_no_variant like sy-msgno value '070',

msg_prog_does_not_exist like sy-msgno value '071',

msg_no_execute_privilege like sy-msgno value '072',

msg_prog_not_executable like sy-msgno value '073',

msg_no_variants_defined like sy-msgno value '074'

msg_invalid_select_option like sy-msgno value '075'

msg_select_param_missing like sy-msgno value '076'

msg_select_jobname_missing like sy-msgno value '077'

msg_select_username_missing like sy-msgno value '078'

msg_cant_del_in_jobtable like sy-msgno value '080'

msg_cant_del_joblog like sy-msgno value '081’

msg_problem_pred_succ like sy-msgno value ‘082’

msg_commit_failed like sy-msgno value ‘083’

msg_no_delete_privilege like sy-msgno value ‘084’

msg_job_running like sy-msgno value ‘085’

64

8.1.3 Reading Syslog Entries in the R/3 System (Part of theXMB Interface)

The following function module is a part of the XMB interface. As it is important for all ofthe interfaces to be able to find out whether an entry has been generated in the syslog,we have shown here that it is possible to read the R/3 syslog from outside. Pleaserefer to the XMB interface documentation for further monitoring functions of externalsystem management tools

You can use the function module SXMI_XMB_SYSLOG_READ to read entries fromthe R/3 System syslog. It is always a good idea to do this whenever thePROBLEM_DETECTED exception is triggered, since in almost all cases, the syslogcontains a precise description of the error.

NOTE: this is not yet a BAPI at the moment therefore it will return exceptions atthe moment

Function name SXMI_XMB_SYSLOG_READ

Short description You can use the function module SXMI_XMB_SYSLOG_READ toread entries from the R/3 System syslog. It is always a good idea to dothis whenever the PROBLEM_DETECTED exception is triggered,since in almost all cases, the syslog contains a precise description ofthe error.

RFC-Interface function SXMI_XMB_SYSLOG_READexporting EXTERNAL_USER_NAME like TXMILOG_EXTUSER type RFC_CHAR length 16 FROM_DATE like SYST_DATUM default SPACE type RFC_DATE length 8 FROM_TIME like SYST_UZEIT default SPACE type RFC_TIME length 6 SERVER_NAME like TBTCJOB_EXECSERVER default SPACE type RFC_CHAR length 20 TO_DATE like SYST_DATUM default SPACE type RFC_DATE length 8 TO_TIME like SYST_UZEIT default SPACE type RFC_TIME length 6importingtables SYSLOG_TBL structure BTCSYSLOG length 255 number of fields 1exceptions CANT_LOG_ACTION EXTERNAL_USER_NAME_MISSING INVALID_DATE_TIME INVALID_SERVER_NAME PROBLEM_DETECTED NOT_LOGGED_ON

Parameter (Input) • Name of external user (required)

• Name of the server whose syslog you want to read (optional,default = current server)

• From date (optional)

• From time (optional)

• To date (optional)

• To time (optional)

65

Note

If dates and times are not specified, the system reads the syslogentries during the last 10 minutes

Parameter (Output) Table containing syslog entries

Exceptions • INVALID_DATE_TIME: The specified date and/or time is invalid.

• INVALID_SERVER_NAME: The specified server name is invalid.

• PROBLEM_DETECTED: The job scheduling system hasdiscovered an error. You can find a precise description in thesyslog.

• CANT_LOG_ACTION: The activity was terminated because theR/3 XMI logging mechanism returned an error.

• MSG_EXT_USER_MISSING: Name of the external user ismissing. This is the name of a user in the external job schedulingsystem.

• NOT_LOGGED_ON: The external management tool has notlogged onto the CCMS XMI interface, The activity cannottherefore be carried out.