![](/cvo_files/imgs_sap_abap/logos/logo_cvo_academy_it.png)
✒️ABAP Los Eventos
ABAP Los Eventos
![ABAP Los Eventos ABAP Los Eventos](https://www.cvosoft.com/cvo_files/imgs_sap_abap/og-images/153.jpg)
Events
Events are crucial for business applications to interact with workflows effectively. Let's delve into their definition and implementation.
Defining Events
Workflows represent dynamic business processes, and for an application to seamlessly communicate with workflows, events play a pivotal role.
Consider scenarios where an application needs to notify:
- Start of a business process
- Completion of a business process or its activity
- Irrelevance of a started activity or process
- Changes in the environment affecting process execution
Events serve as the interface through which business applications communicate. In the context of workflows, an event signifies a change in the state of a business object instance.
For instance, when a user modifies material master data for material XXXY, the XXXY business object triggers the "Changed" event.
To utilize an event as a communication link between an application and a workflow, certain elements are essential:
- Event Definition: This entails the technical name of the event, often described using past tense verbs (e.g., created, modified, released). Additionally, events are defined by their parameters, including default ones like name, object type, object instance, and event creator, with the provision to define additional parameters if required.
- Event Creator: The entity—be it a program, workflow, or person—that initiates the event.
- Event Receiver: This generic term refers to entities that react to the event, typically workflows or waiting tasks.
- Event Linkage: It specifies the relationship between the event and its receiver, where rules govern when and how the receiver receives the event.
Creating Events
Events are crafted within the Business Object Repository, accessible through transaction SWO1. Avoid coding during event definition. Key data to input includes the event name and its parameters.
Launching Events from SAP Applications
Before an event is triggered by an application, its creation must be programmed within the application. SAP's standard programs often define event triggers, necessitating only event linkage and certain customizing configurations.
However, for specific business processes, custom event creation might be required, entailing defining how the event will be launched from the application. Utilize SAP-provided functions for straightforward event launch programming.
In case we need to launch a new event from a standard SAP program, we have the following options:
- Through change documents.
- Through the status management system.
- Through message control.
- Utilizing the Logistics Information System (LIS).
- Via HR master data.
- Via Business Transaction Events (only for finance).
- Through specific customization for each application.
The first three cases are the most commonly used, while the rest are specific to certain modules (HR - FI) and isolated cases.
Triggering Events with Change Documents
Many SAP business applications utilize change documents to record modifications, typically for data master maintenance transactions. These documents outline the operation causing the change (creation, modification, deletion) and record business object data changes.
Change documents are generated only when a field designated as "relevant for change document" undergoes alteration. Before defining an event based on a change document, ensure proper customizing of fields or conduct tests.
Transaction SWEC facilitates the creation of such events, requiring specifications like document code, business object, event, and triggering activity (creation, modification, deletion).
Triggering Events by Status Change
For applications employing status management systems, event triggering based on system status changes is feasible. While standard system statuses come predefined, custom statuses can be configured via customizing.
Transaction BSVW facilitates the creation of such events. Select the type of status (system or user-defined), specify the object type, its event, and activate accordingly.
Linking Event to Workflow
To initiate a workflow automatically from an event, configuration within the workflow builder (transaction SWDD) is necessary. Specify the object type and event that will trigger the workflow. This establishes a binding, facilitating data transfer from the event container to the workflow's.
Start Conditions
SAP offers a straightforward method to limit workflow initiation upon event occurrence via start conditions. Configure these via transaction SWB_COND, selecting the object type (e.g., purchase requisition) and associated events. Define logical conditions using event container variables to control workflow launch.
Event Verification and Programmatic Event Triggers
To verify events, transactions like SWU0 for event simulation and SWUE for event creation prove useful.
Programs intending to trigger events should utilize the SWE_EVENT_CREATE function module. The logical structure of such programs involves populating event containers with necessary parameters, composing the object key to invoke the event, calling the SWE_EVENT_CREATE function, handling exceptions, and explicitly triggering the event with COMMIT_WORK.
 
 
 
Sobre el autor
Publicación académica de Jaime Eduardo Gomez Arango, en su ámbito de estudios para la Carrera Consultor ABAP.
Jaime Eduardo Gomez Arango
Profesión: Ingeniero de Sistemas y Computación - España - Legajo: SW34C
✒️Autor de: 149 Publicaciones Académicas
🎓Cursando Actualmente: Consultor en SAP Fiori
🎓Egresado de los módulos:
Disponibilidad Laboral: FullTime
Presentación:
Ingeniero de sistemas y computación con 8 años de experiencia el desarrollo frontend & backend (react/node) y en cloud (aws), actualmente desarrollando habilidades en sap btp, ui5, abap y fiori.
Certificación Académica de Jaime Gomez