Show TOC Start of Content Area

Syntax documentation Triggering Events from ABAP Programs  Locate the document in its SAP Library structure

Use

Use the RAISE method of the CL_BATCH_EVENT class to trigger an event from an ABAP program.

Prerequisites

The event is defined in the system.

Example

The code excerpt below shows how you can use the CL_BATCH_EVENT class to trigger an event from an ABAP program.

DATA:

    p_eventid   TYPE btceventid,

    p_eventparm TYPE btcevtparm,

    p_server    TYPE btcserver.

 

* Obligatory parameter: EventID.

* EventID should be an existing event already defined in transaction

* SM64 or using CREATE method of class CL_BATCH_EVENT:

  p_eventid   = 'SAP_TEST'.

* Optional parameters: event parameter and target server.

  p_eventparm = 'Event parameter'.

  p_server    = ''.

 

  CALL METHOD cl_batch_event=>raise

    EXPORTING

      i_eventparm                    = p_eventparm

      i_server                       = p_server

      i_eventid                      = p_eventid

    EXCEPTIONS

      excpt_raise_failed             = 1

      excpt_server_accepts_no_events = 2

      excpt_raise_forbidden          = 3

      excpt_unknown_event            = 4

      excpt_no_authority             = 5

      OTHERS                         = 6.

  CASE sy-subrc.

    WHEN 0.

      EXIT.

    WHEN 1 OR 2 OR 3.

* Raise failed.

    WHEN 4.

* Event does not exist.

    WHEN OTHERS.

* Raised failed due to unknown reason.

  ENDCASE.

 

 

End of Content Area