cancel
Showing results for 
Search instead for 
Did you mean: 

Event Reporting (with Location Codeset) - How to report the Expected Event?

Former Member
0 Kudos

I notice that when I report an event with a location codeset the event is always reported on the event handler as unexpected even if there is a Expected Event containing the same LOC1.

How do I ensure that the expected events are reported when the LOC1 information matches? Can someone please provide some guidance and if a function is required a brief example.

In the attached artifacts, I reported the 'Arrival at Destination' event from TM. Within the event data extractor we are adding a location codeset to the event message so that LOC2 can also be populated during event reporting during external to internal location mapping.

As you can see within the event handler the event was reported as an Unexpected event with my mapped internal location codeset. The Expected Event is left unreported?

Accepted Solutions (1)

Accepted Solutions (1)

former_member190756
Active Contributor
0 Kudos

Hi Jacob,

the logical key of an EE is:

Event Code

Location Code Set

Loc Id1

Loc Id 2

Partner Code Set

Partner ID

Data Code Set

Data ID

If your EE has no Location Code Set but you message has one it does not match and it is processed as unexpected event.

Best regards,

Steffen

Former Member
0 Kudos

Steffen,

Thanks for the quick reply. A couple of additional questions:

1. Where is the Expected Event Location Code Set stored?

2. What is the best way to determine the Location Code Set based when the Expected Event is extracted in order to match the internal location code set mapping when an event is reported?

former_member186607
Active Contributor
0 Kudos

Hi Jacob,

if you want to achieve that only LOCID1 has to match between event message and expected event you can implement a location matching function (in which then only LOCID1 is checked) and assign it to your expected event profile.

Location matching function can be created via IMG activity "Define Functions for Expected Events" and assignment to expected event profile is done via IMG activity "Define Profiles for Expected Events" - for each expected event you can assign such a function to 'Check Location'.

Best regards, Daniel

Former Member
0 Kudos

Thanks Daniel,

I'm not an application developer so is there any starter information I should give my developer as guidance? In this case I don't believe there are any standard examples so I'm not sure what kind of function details I can provide him. Any additional information would be greatly appreciated.

Thanks

former_member190756
Active Contributor
0 Kudos

Hi Jacob,

is the Location Code Set needed?

If not just remove it from the message sending or add it to the Expected Events. This would be the easiest way.

Some info about Location Matching functions are in IMG available:

SAP Customizing Implementation Guide

     Event Management

          Event Handlers and Event Handler Data

               Expected Events

                    Define Functions for Expected Events

Best regards,

Steffen

Former Member
0 Kudos

Steffen,

Yes, the location code set is required if I want to utilize the External to Internal location code mappings during event posting. This is also utilized when an event is received via IDOC from our carriers to map location based on UN-CODE.

I'll work the developer and if he has any pressing questions regarding the type of function module to use I may have additional questions.

Again I appreciate the feedback and assistance.

Former Member
0 Kudos

Daniel,

Can you please provide some insight on the following when the 'Check Location' is called on the expected event in the profile:

**Note: non-developer speaking here****

1. Which data structure elements need to be compared when this function is called? I mean when the function is called I know we need to compare the "reported" event message LOC1 to the "expected" event message within the handler LOC1. Where will the "reported" event message and "expected" event message reside when this function is called?

2. What should be returned out of this function once the check is either True or False?
Without an example function from standard it's much more difficult for an Analyst, such as myself, to comprehend.

Thanks again for the assistance.

former_member190756
Active Contributor
0 Kudos

Hello Jacob,

this is the interface of the function:

FUNCTION Z_CHECK_LOC_FUNC .
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     REFERENCE(EVENT) TYPE  /SAPTRX/EH_EXPEV_DYN
*"     REFERENCE(MESSAGE) TYPE  /SAPTRX/EVM_HDR_STR
*"     REFERENCE(EH_MODEL) TYPE REF TO  /SAPTRX/CL_EH_PROCESS_MODEL
*"  EXPORTING
*"     REFERENCE(RESULT) TYPE  SYBINPT
*"  EXCEPTIONS
*"      NOT_VALID
*"----------------------------------------------------------------------


Event contains the EE data and Message the data of the current processed Message.


EH_MODEL all other EH data.


With this data you could implement your check.


If the check is not true meaning the Event Message does not match the EE just do "RAISE not_valid." in the coding.


Best regard,

Steffen

Former Member
0 Kudos

Hi Jacob,

Follow below steps:

1. Create a new custom functional module e-g Z_LOC_CHECK1 and follow Steffen direction on Local Interfaces which he referred.

E-g

FUNCTION z_check_loc1.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     REFERENCE(EVENT) TYPE  /SAPTRX/EH_EXPEV_DYN
*"     REFERENCE(MESSAGE) TYPE  /SAPTRX/EVM_HDR_STR
*"     REFERENCE(EH_MODEL) TYPE REF TO  /SAPTRX/CL_EH_PROCESS_MODEL
*"  EXPORTING
*"     REFERENCE(RESULT) TYPE  SYBINPT
*"  EXCEPTIONS
*"      NOT_VALID
*"----------------------------------------------------------------------

*Check Expected event Location id 1 matches with Actual Event Message Location1


IF NOT event-LOC_ID_1 EQ message-LOCID1.
     RAISE not_valid.
   ENDIF.


ENDFUNCTION.


ABAP'er know how to take it from above code.


2.  Create new Location Matching Functions in IMG -> Event Management -> Event Handlers and Event Handler Data -> Expected Events -> Define Functions for Expected Events -> click Location Matching Functions -> Create name like Z_CHECK_LOC1 and assign step 1 function module z_check_loc1.


3. Go to IMG ->  Event Management -> Event Handlers and Event Handler Data -> Expected Events -> Define Profiles for Expected Events -> Update Expected Event Profiles -> Select your expected event profile -> Update Profile Group -> Update profile items -> Select Arrival Destination -> Assign

Step 1 name activity name Z_CHECK_LOC1 in Check Location field and uncheck "Do not check" then save.


Please check and let me know.


Regards


GGOPII

Answers (0)