Skip to Content
avatar image
Former Member

EH generation

Dear EM experts

The BAPI /SAPTRX/BAPI_EH_ADDEVENTMSG_02 has an Option EH_GENERATION_MODE. The documentation says, the Option A has an effect that all Messages generate an EH without customizing check. When I run the BAPI, I get the error "no active Event handler found", but the message Details are updated in EVM_HDR. Would it be an Option to put A into the EH_GENERATION_MODE to resolve this issue? and if so, what is the function module that I have to fill into field EH_GENERATION_FUNCTION.

Any other other tips how I can get the message tobe processed and put into the execution tab of the freight unit?

Thanks in advance


Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    Dec 03, 2014 at 07:45 AM

    Hello Petra,

    this option is for scenarios where you have no application system e.g. postal scenarios.

    The EH is not generated automatically you have to create a function module where you code your logic to create all the EH data. For EM TM sceanrio this is not needed.

    Best regards,


    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Dec 03, 2014 at 03:06 AM

    Hi Petra,

    The below information has provided by SAP in Option A for EH_GENERATION_MODE

    "Each event message generates an event handler (no check in Customizing table).

    In this case, you must specify the name of the function module that generates the event handlers in variable EH_GENERATION_FUNCTION".

    If you want to create manually event handler in SAP EM then you can use Tcode /SAPTRX/EH_CREATE.

    I just want to understand whether all basic configurations completed in SAP EM <-> SAP TM.

    Can you check this discussion and check activity template FM /SAPTRX/TMS_UPDATE_FU



    Add comment
    10|10000 characters needed characters exceeded

  • Jun 13, 2016 at 01:20 PM

    Dear All,

    in my "standard scenario" I have a custom application object against which an event handler is created and later the events are posted.

    Also, I might have an event posting related to an event handler that is not created yet: in this case I have to create it. So, this means that option A has to be set up in the BAPI /SAPTRX/BAPI_EH_ADDEVENTMSG_02? The BAPI creates the EH only if the event handler does not exist in the EM system?

    Best regards,


    Add comment
    10|10000 characters needed characters exceeded

    • Hi Pietro,

      if you want to create a new EH based on an event message (BAPI /SAPTRX/BAPI_EH_ADDEVENTMSG_02), you can use EH generation function for this requirement.
      You have to implement then such a EH generation function that fits your needs. You can configure your EH generation function via IMG activity "Define Criteria for Event Message Processing".

      In the EH generation function you can e.g. first check if an EH already exists and only create new EH if this checks fails. You can check function module /SAPTRX/PTA_AUTH_EH_CREATE_HV as an example. This is used in PTA scenario, where authentication event message comes in for not existing EH.

      Best regards, Daniel