cancel
Showing results for 
Search instead for 
Did you mean: 

Set Expected Event from Event Handler Creation?

Former Member
0 Kudos

We have an event handler that is based on non-SAP events.  All of these events are currently configured as unexpected.  We want to create an expected event with the planned date/time of XX days after event handler creation.  Is there a way to do this?  If not, is there a way to set the planned date/time for XX days after an unexpected event is reported?  Since these events are non-SAP we can't configure an expected event based on the 'Application System'.

Accepted Solutions (1)

Accepted Solutions (1)

former_member190756
Active Contributor
0 Kudos

Hello Steven,

you can also create, update and delete expected events by sending an Event Message.

You have to fill structure TRACKEEMODIFY of the BAPI /SAPTRX/BAPI_EH_ADDEVENTMSG_02.

And you need activity EVM_EE_UPDATE in your rule set.

How to fill the structure is described below in the docu.

To define your EE date based on EH creation you need maybe an own activity. The creation date you find in the EH Header structure which is available in the activity interface.

Best regards,

Steffen

Short Text

Update EE List from Event Message EE MODIFY Table

Functionality

This method updates the expected event list based on the expected event
modification data sent in an event message.

When calling BAPI /SAPTRX/BAPI_EH_ADDEVENTMSG_02, the activity checks table
TRACKEEMODIFY to see whether expected event modification data was sent with the
event message.

This table can be used to create new expected events, to delete or update
existing expected events.

This method can only be used within rule activities. Two optional parameters
can be set to provide an expected event profile to the method:

  • Use EH EE Prof.: Set this parameter to 'X' if the expected event
    profile of the corresponding event handler type should be used by the activity
    method

  • EE Profile: Enter the name of an expected event profile directly.
    This parameter is only taken into account if parameter Use EH EE Prof.
    is not set to 'X'.

Fill the structure TRACKEEMODIFY as follows:

Delete, insert, and update the expected event list are supported. The key for

this processing is the internal event code(EVTID)(mapped from the

external event code set and ID), the location code set(LOCCOD) ,code

ID1(LOCID1) and ID2(LOCID2), and the partner code

set(PARCOD) and code ID(PARID).

Field EVTACT specifies the action that is to be performed for this

data set:

  • 'D':' Deleting specified expected events date / expected events
    message date.

  • 'I':  Inserting specified new expected events date / expected events message
    date. Since a sequence is defined for expected events, you have to specify a
    relative position when creating a new expected event.

  • 'U': Updating specified expected events date / expected events message date.
    If you specify the expected events date as blank, system update this expected
    events as no expected events date.

  • ' ' :  The duration of the expected event date can be updated relative to
    the current date using field ETADUR, The duration of the expected
    relative to the current date using field ETADUR, The duration of the
    expected event message date can be updated using field MSGDUR. In this
    case the other fields remain blank. This allows you to report a delay of a
    certain duration.

  • 'A': Updating specified additional date / time / time zone ( DATE1 - 5,
    TIME1 - 5, TZONE1 - 5)
    only. (Do not update other expected/message date.)
    In this case the other fields remain blank. This allows you to update the
    additional date / time / time zone.

  • 'X': Insert or Update. The system checks if the expected event already
    exists. Depending on the result an Update (same as 'U') or an Insert (same as
    'I') is performed.

The expected events date are inserted/updated according to fields
"ETXDAT, ETXTIM and ETXZON " or "ETXTST (UTC
timestamp) and ETXZON ".  For earliest expected events date,
use  "ETEADT, ETEATI and ETXZON " or "ETEATS
(UTC timestamp) and ETXZON " and for latest expected events date,
use  "ETLTDT, ETLTTI and ETXZON " or "ETLTTS
(UTC timestamp) and ETXZON "

The expected message events date are inserted/updated according to fields
"MSGDAT, MSGTIM and MSGZON " or "MSGTST (UTC
timestamp) and "MSGZON ". For earliest expected message events date,
use  "MSEADT, MSEATI and MSGZON " or "MSEATS
(UTC timestamp) and MSGZON"  and for latest expected events date,
use  "MSLTDT, MSLTTI and MSGZON " or "MSLTTS
(UTC timestamp) and MSGZON "

Field MODREF references another entry in this table for
delete-inserts, that is, if a new expected event is to be inserted at the same
position in the expected event list as an expected event that was previously
deleted.

Return code:

0: Success

1:  Mapping of event code failed

2: Expected event already exists.

3: Referenced expected event was not passed with event message

4: Referenced expected events does not exist

5:  No expected date available

6:  Expected event insertion failed

7: Expected event for update does not exist

8: Expected event update failed

9: Expected event for deletion does not exist

10: Expected event deletion failed

11: Add duration failed

12: No time zone provided

13: Date conversion failed

14: Expected event profile does not exist

Example

MODCNT EVTACT EVTID LOC ID1 MODREF

1DARRIVALLOC1
2DDEPARTURELOC1
3IARRIVALLOC21
4IDEPARTURELOC22
5UARRIVALLOC3
6UDEPARTURELOC3

In this example, the existing expected events ARRIVAL at LOC1 and
DEPARTURE at LOC1 are replaced by the expected events ARRIVAL at
LOC2 and DEPARTURE at LOC2 at the former positions in the
expected event list. If no MODREF is specified, the position is
determined by the estimated date and time. If more expected events have to be
added than there are existing expected events to replace, MODREF can be
used multiple times. Events are added in sequence of MODCNT and then at
the position of MODREF. A blank EVTACT indicates that the
expected event is not updated, but used as a reference for other expected events
to be inserted.

If a change to the expected event list needs to be sent independently from
reporting expected events, a certain internal event code (for example,
DDLCHANGE - deadline change) can be set up and then used to send an
unexpected event with the updates to the expected event list.

Notes

All the date/time/time zone field will not be updated, if the given entry is
initial.  If you also need to update e.g. Date field to initial, please create
your own rule activity based on this activity.

Former Member
0 Kudos

Hi Steffen,

Iam exploring on the above option what has been suggested..

Config

1. Creates and expected event YAUTO_TNT_DEACT

1a. created a EE Profile for YAUTO_TNT_DEACT with Expected Event date set to 1. Applciation System.

2. In the Activity FM , created a new acitivty FM to set the number of days for the expected event YAUTO_TNT_DEACT.

3. Finally in the rule set for the unexpected event YCARRIER_POD..

     a. iam caling the multi task activity to call the above activity FM

     b. and in the main rule set, afterYCARRIER_POD, i have added

               RULE                                   Condition         Activity                                             True Rule

  185       PARAMETER_AND_EEM                         PARAMETER_CHANGE                              EVM_EE_UPDATE

190          EVM_EE_UPDATE                                   EVM_EE_UPDATE                                        BW_UPLOAD

200          BW_UPLOAD                                             BW_UPLOAD

But when the POD event is posted, i dont see the YAUTO_TNT_DEACT event being created in the /SAPTRX/EH_EXPEV table hence not able to see the expected event.

LEt me know if iam missing anything.

Thanks

Radhika

former_member190756
Active Contributor
0 Kudos

Hello Radhika,

you want to create an EE by sending an Event Message?

Then you don't need the EE in the EE profile. Yo have to sent an Event Message and fill TRACKEEMODIFY structure and you need as you already have EVM_EE_UPDATE activity.

Example is Multi Task activity OBP20_ASN

To test it just create an report and send an event message:

Fill the header structure

e.g.

ls_header-evtcnt = '001'.

ls_header-evtid = 'ADD_NEW_EE'.

ls_header-trxcod = 'TEST'.

ls_header-trxid = '4711'.

ls_header-evtdat = sy-datlo.

ls_header-evttim = sy-timlo.

and the TRACKEEMODIFY

e.g. with this an Event is added

ls_eemodify-evtcnt = '001'.

ls_eemodify-modcnt = '001'.

ls_eemodify-evtid  = 'EVENT_CODE_TO_BE_ADDED_TO_EH'.

ls_eemodify-evtact = 'I'.

ls_eemodify-etxdat = '20151124'.

ls_eemodify-etxtim = '123000'.

ls_eemodify-etxzon = 'CET'.

Adapt the IDs and Codesets to your needs. Event Codes to be added must be available in the Event Code customizing /SAPTRX/TSC0EC.

Afterwards Event Code 'EVENT_CODE_TO_BE_ADDED_TO_EH' should be availabe in you EH.

Best regards,

Steffen

Former Member
0 Kudos

Thanks Steffen. I would like to create/update the expected event YAUTO_TNT_DEACT at the trigger of unexpected event YCARRIER_POD. So even in that case we dont need the EE profile?

Thanks

Radhika

Former Member
0 Kudos

Hi STeffen,

One quick clarifyign Question. We have created an event code called YAUTO_TNT_DEACT. And as per your suggestion, i have removed the EE Profile.

So from your mail above what should be the value of

1. EVENT_CODE_TO_BE_ADDED_EH

2. ADD_NEW_EE

Thanks

Radhika


former_member190756
Active Contributor
0 Kudos

Hi Radhika,

according to your example:

1. EVENT_CODE_TO_BE_ADDED_EH   =  YAUTO_TNT_DEACT

2. ADD_NEW_EE = YCARRIER_POD

You don't need to enhance the EE profile for that as you create the new EE YAUTO_TNT_DEACT by an event message.

For the unexpected event code YCARRIER_POD that triggers the creation you maybe need to enhance the EH Type and allow this event code as unexpected event code.

Best regards,

Steffen

Former Member
0 Kudos

Hi Steffen,

     We followed the same steps what you mentioned in this thread, the below is the code what we wrote but still no luck. Will appreciate your help in guiding us,

    l_trackingheader-evtcnt = '001'.
    l_trackingheader-evtcod = 'YCARRIER'.
    l_trackingheader-trxcod = 'YTRACK_NO'.
    l_trackingheader-trxid  = l_trkid-trackingid.
    l_trackingheader-evtid  = 'POD'.
    l_trackingheader-evtdat = '20131212'.
    l_trackingheader-evttim = '080000'.
    l_trackingheader-evtzon = 'PST'.

    l_trackemodify-evtcnt = '001'.
    l_trackemodify-modcnt = '001'.
    l_trackemodify-evtid  = 'YAUTO_TNT_DEACT'.
    l_trackemodify-evtact = 'I'.
    l_trackemodify-etxdat = '20131230'.
    l_trackemodify-etxtim = '000000'.
    l_trackemodify-etxzon = 'PST'.

    APPEND l_trackemodify TO lt_trackemodify.
    APPEND l_trackingheader TO lt_trackingheader.

    CALL FUNCTION '/SAPTRX/BAPI_EH_ADDEVENTMSG_02'
   EXPORTING
     simulate                         = ' '
     synchronous                  = 'X'
    TABLES
      trackingheader              = lt_trackingheader
     trackeemodify                = lt_trackemodify
      return                             = lt_bapiret2.

  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
* EXPORTING
*   WAIT          =
* IMPORTING
*   RETURN        =

Former Member
0 Kudos

Hi Steffen,

Just to add to Santosh's code, from configuration YCARRIER_POD is added as unexpected event code.

From rule set as i had already mentioned on trigger of YCARRIER_POD a multi task activity will call the above Activity FM.

Activity : YTNT_DEACT_EVM ( Activity FM name)

Event ID: POD

Tracking ID CS: YTRACK_NO

Event_Code : YCARRIER

We still are not able to see YTNT_AUTO_DEACT in the EH as when i try to Reproces the event message in Simualtion mode, there are no errors, but the EH_EXPEV_DYN structure with all the date/time fields are coming as 000000000000.

Please let us know if there is somethign else we need to do..

thanks

Radhika


former_member190756
Active Contributor
0 Kudos

Is the Event Message processed for the EH?

If yes you should find a return code for the EVM_EE_UPDATE Activity in TR SLG1 for object SAPTRX.

Maybe you have to switch on task logging in the Muli Task Activity.

With the return code it should be possible to find out what went wrong.

Best regards,

Steffen

Answers (0)