Show TOC

Programming AgentsLocate this document in the navigation structure

Use

You need to have an agent to react automatically and independently to events in an application according to its order. The agent can then forward the prepared data to one or more applications. For more information about the agents in the Agent Framework, see Agent.

Prerequisites

You are using multiple applications and you want them to communicate with one another fully-automated and in near-time by means of agents. In addition, you have specifically defined the tasks that the agents are to take on in your process chain.

Procedure

For more information about the steps described below, see Class Builder (transaction code SE24) under Help —> Application Help.

  1. Navigate in the Class Builder by calling up transaction SE24 and creating the class there. Enter a description and define that you are instantiating the private class.

  2. Change to the Properties tab page and select the superclass pushbutton. Enter the superclass CL_OAF_AGENT and save. You have now created a class in the Class Builder, inherited the methods in abstract class CL_OAF_AGENT, and implemented the interface IF_OAF_AGENT.

  3. Change to the Methods tab page and redefine the method EXECUTE.

    Note

    When you program the method EXECUTE, you can use the interface methods IF_OAF_AGENT_LOG and IF_OAF_AGENT_CP

  4. If you want to change or enhance the program code implemented in the methods of class CL_OAF_AGENT, you have to program this as well.

  5. Change to the Interfaces tab page and create the interface IF_OAF_AGENT_CREATE in addition. This makes the statistical method S_GET_AGENT available to you. Program this method.

Result

You have created a class with the required interfaces and methods. To enable you to schedule and execute the programmed agents, you have to enter the class you created in the Customizing activity Configure Agents and execute the relevant Customizing activities named in Set up Agents in Customizing. For more information about scheduling and executing agents, see Executing Agents.

Example

You can find an example implementation in class CL_OAF_TEST_AGENT_AFT01 in the Class Builder.

More Information

For more information about the individual classes, interfaces, and methods, see Programming Objects and the system documentation for classes, interfaces, and methods.