Registration

Dear SAP Community Member,
In order to fully benefit from what the SAP Community has to offer, please register at:
http://scn.sap.com
Thank you,
The SAP Community team.
Skip to end of metadata
Go to start of metadata

Step1: Create event from transaction SM62.


 
Give event name and description and press save button


 

 
 
Step2: Create a program that triggers this event by calling the FM 'BP_EVENT_RAISE'.

*&---------------------------------------------------------------------*
*& Report  Z_TRIGGER_EVENT                                             *
*&                                                                     *
*&---------------------------------------------------------------------*
*&                                                                     *
*&                                                                     *
*&---------------------------------------------------------------------*

REPORT  Z_TRIGGER_EVENT                         .


CALL FUNCTION 'BP_EVENT_RAISE'
  EXPORTING
    eventid                      = 'Z_TRIGGER_JOB'
 EXCEPTIONS
   BAD_EVENTID                  = 1
   EVENTID_DOES_NOT_EXIST       = 2
   EVENTID_MISSING              = 3
   RAISE_FAILED                 = 4
   OTHERS                       = 5
          .
IF sy-subrc <> 0.
 Write: 'Event failed to trigger'.
else.
 Write: 'Event triggered'.
ENDIF.


Step3: Configure the background job from transaction SM36.

In the initial screen give job name and job class and press "Start condition" button.
 
In the popup screen press "After event" button and give the event name and then press save button.

Now go back to the initial screen and press "Step" button

Provide program and variant name and after providing all the values press save button.

In the initial screen press save button.

 
Step4: Now execute the program to trigger the event and as well check the background job.
 
Run transaction SM37


 
Check the status of job created by the program.


 
Now check the spool to see the generated list



4 Comments

  1. Guest

    Dear Joyjit,

    Scheduling jobs based on events is new to me. I have a scenario wherein I need an event triggered when a particular file coming from a 3rd party (SSP5) reaches the SAP applicaltion server. Do you have any idea how this can be implemented?

    Kind regards,

    Ross

  2. You can create an RFC enabled Function Module that calls:

    CALL METHOD cl_batch_event=>raise

    or create a SICF Handler which can be triggered from you external program.

  3. Guest

    Hello,

    You can use SAP delivered program BTC_EVENT_RAISE for this purpose.

    It is not required to write a custom program as Z_TRIGGER_EVENT.

    Salai.

  4. Thanks for this. This works well.

    However, I am facing one issue regarding this - When I raise a Event (say in client 200), the job gets triggered in multiple clients (on same server)  wherever I have scheduled Jobs on this particular Event.

    Are Events Client Independent ?