cancel
Showing results for 
Search instead for 
Did you mean: 

SM62 Event: CL_BATCH_EVENT does not trigger immediately

adityaw
Participant

Hi all!

Created SM62 event to run a scheduled background job.
The event is raised in background task during MIGO posting using Function Module 'BP_EVENT_RAISE' (which in turn calls method CL_BATCH_EVENT=>RAISE).
This used to work perfectly fine in older SAP version 1610. But after upgrade to version 2021, it stopped working.
So, I debugged the method CL_BATCH_EVENT=>RAISE and found that a new piece of standard code was added in the method:

 IF p_eventid <> cl_batch_event=>event_sap_end_of_job.
DATA(lv_trigger_immediately) = lcl_handle_raise_event=>handle_event(
iv_eventid = p_eventid
iv_eventparm = i_eventparm
iv_server = p_server
iv_force_event = i_force_event ).
IF lv_trigger_immediately = abap_false.
RETURN.
ENDIF.
ENDIF.

As you can see, the method lcl_handle_raise_event=>handle_event, returns the 'trigger immediately' flag and, in my case, this always comes back as ABAP_FALSE.
So, debugging this method, I find that if the event is found to be stored in table btcraiseevt, it will never return 'trigger immediately' flag.

Thus, my question is how to ensure that a custom event always triggers immediately?

View Entire Topic
thkolz
Contributor
adityaw
Participant
0 Kudos

Hi Thorsten,
Thank you for the note, I implemented it but unfortunately this did not solve the problem.

thkolz
Contributor

Then I would open an incident at SAP.

adityaw
Participant
0 Kudos

Yes, I have raised it to SAP. But I found that in another similar system, this issue is not occurring. Root cause is due to the entry in table btcraiseevt for the custom event. If entry is found that is when the issue arises. Do you have any idea when and how an entry is populated in this table or how to remove it in a standard way?

Wilbert_Jeuken
Explorer
0 Kudos

Hello Aditya,

Did you get any response from SAP on this issue? We're facing the same issue at the moment (no event driven job is triggered when the event has a record in btcraiseevt), and I'm curious as to any response you've gotten from SAP on this.

Kindest regards, Wilbert

adityaw
Participant
0 Kudos

Hi @Wilbert_Jeuken,

Really sorry for super late reply, but I did not pursue this further with SAP because our client needed immediate resolution and therefore, I implemented alternative solution (using Background Task in FM and directly submitting the program) instead of originally using background unit FM and raising event in SM62 to run the program.