SAP EM Newsletter

Subscribe for SAP EM related news
Banner
Banner

Attention: open in a new window. PDFPrintE-mail

2008
04
Feb

SAP EM program to list EH detail

This is a program that I wrote to list out an Event Handlers Expected event table (/SAPTRX/EH_EXPEV), the events posted to that EH (/SAPTRX/EH_EVMSG), the Expected Event Modify entries for each event posted (/SAPTRX/EVM_EEM) and a list of the parameter
changes made to the EH (/SAPTRX/EVM_PAR).

You will often need to look at these tables to see why your event handlers aren't updating correctly. This program greatly reduces the errors and guesswork out of trying to find out what went wrong. 

*&-----------------------------------*
*& Report  Z_LIST_EVENTS_EEM
*&-----------------------------------*

REPORT  z_list_events_eem LINE-SIZE 178.

TABLES: /saptrx/eh_evmsg,
        /saptrx/eh_hdr,
        /saptrx/evm_eem,
        /saptrx/eh_expev,
        /saptrx/evm_par.

SELECTION-
SCREEN BEGIN OF BLOCK b1 
   WITH
 FRAME TITLE text-002.
SELECT-OPTIONS: s_system FOR /saptrx/eh_hdr-ao_system,
                s_aoid 
FOR /saptrx/eh_hdr-ao_id,
                s_aotype 
FOR /saptrx/eh_hdr-ao_type.
SELECTION-
SCREEN END OF BLOCK b1.


INITIALIZATION.
  
REFRESH s_system.
  s_system-low = 
'SAPECC'.
  s_system-option = 
'EQ'.
  s_system-
sign = 'I'.
  
APPEND s_system.

START-
OF-SELECTION.
  
SELECT * FROM /saptrx/eh_hdr
    
WHERE ao_system IN s_system AND
          ao_type   
IN s_aotype AND
          ao_id     
IN s_aoid.

*** EH Header Detail
    
IF /saptrx/eh_hdr-eh_active = 'X'.
      
FORMAT COLOR COL_HEADING INTENSIFIED OFF.
    
ELSE.
      
FORMAT COLOR COL_NEGATIVE.
    
ENDIF.
    
WRITE:/ 'Order:  ', s_aoid-low(10), 

            ' Line', s_aoid-low+10(6),

            ' EH GUID:', /saptrx/eh_hdr-eh_guid.

*** EH Expected Events
    
FORMAT COLOR COL_GROUP.
    
SELECT * FROM /saptrx/eh_expev
      
WHERE eh_guid = /saptrx/eh_hdr-eh_guid.

      
WRITE: /5 /saptrx/eh_expev-event_code,
             
'Event:',
              (
20) /saptrx/eh_expev-event_exp_date,
              (
20) /saptrx/eh_expev-event_date.
      
CASE /saptrx/eh_expev-event_status.
        
WHEN ' ' OR 'N'.
          
WRITE'Not expected'.
        
WHEN 'R'.
          
WRITE'Reported    '.
        
WHEN 'O'.
          
WRITE'Overdue     '.
        
WHEN 'E'.
          
WRITE'Expected    '.
      
ENDCASE.
      
WRITE' Msg:',
          (
20) /saptrx/eh_expev-msg_exp_date,
          (
20) /saptrx/eh_expev-msg_rcvd_date.

    
ENDSELECT.
    
ULINE.

*** EH Event Messages
    
SELECT * FROM /saptrx/eh_evmsg
      
WHERE eh_guid = /saptrx/eh_hdr-eh_guid
      
ORDER BY event_date_utc.

      
IF /saptrx/eh_evmsg-not_relevant = 'X'.
        
FORMAT COLOR COL_NEGATIVE.
      
ELSE.
        
FORMAT COLOR COL_POSITIVE.
      
ENDIF.
      
WRITE: /(20) /saptrx/eh_evmsg-event_code,
              (
22) /saptrx/eh_evmsg-msg_guid,
              
'Evt:',
              (
20) /saptrx/eh_evmsg-event_date,
              
'Procd:',
              (
20) /saptrx/eh_evmsg-proc_date,
              
'Msg Rec:',
              (
20) /saptrx/eh_evmsg-msg_rcvd_date.

*** Expected Event Modify Entries
      
FORMAT COLOR COL_GROUP INTENSIFIED ON.
      
SELECT * FROM /saptrx/evm_eem
         
WHERE evt_guid = /saptrx/eh_evmsg-msg_guid.

        
WRITE: /5 /saptrx/evm_eem-evtid(20),
                (
1)  /saptrx/evm_eem-evtact,
                
'Evt:',
                (
20) /saptrx/evm_eem-etxdat,
                (
20) /saptrx/evm_eem-etxtim,
                
'Msg:',
                (
20) /saptrx/evm_eem-msgdat,
                (
20) /saptrx/evm_eem-msgtim.
      
ENDSELECT.

*** Parameter Changes
      
FORMAT COLOR COL_GROUP INTENSIFIED OFF.
      
SELECT * FROM /saptrx/evm_par
         
WHERE evt_guid = /saptrx/eh_evmsg-msg_guid.

        
WRITE: /5  ''.

        
CASE /saptrx/evm_par-partyp.
          
WHEN 'I'.
            
WRITE 'Info   '.
          
WHEN 'C'.
            
WRITE 'Control'.
        
ENDCASE.

        
WRITE:  (20) /saptrx/evm_par-param_name,
                (
20) /saptrx/evm_par-param_value.
        
CASE /saptrx/evm_par-action.
          
WHEN 'S'.
            
WRITE 'Insert'.
          
WHEN 'C'.
            
WRITE 'Change'.
          
WHEN 'D'.
            
WRITE 'Delete'.
        
ENDCASE.

      
ENDSELECT.

      
ULINE.

    
ENDSELECT.

  
ENDSELECT.

END-OF-SELECTION.

Last Updated (Monday, 04 February 2008 18:16)
Free software downloads