Blogs

Kevin Wilson

SAP EM program to list EH detail
Kevin Wilson Active Contributor Bronze: 250-499 points
Business Card
Company: Q Data USA, Inc. and ERPGenie.COM
Posted on Feb. 04, 2008 05:15 PM in Business Process Expert

URL: http://erpgenie.com/index.php?option=com_content&task=category§ionid=5&id=75&Itemid=76

Subscribe.Subscribe
Print. Print
Permalink Permalink
Share

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 <span style="font-size: 10pt">LINE</span>-SIZE <span class="l1s321">178</span>.

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

SELECTION-SCREEN <span style="font-size: 10pt">BEGIN</span> OF <span class="l1s521">BLOCK</span> b1 
   WITH FRAME <span class="l1s521">TITLE</span> text-002.
SELECT-OPTIONS: s_system <span style="font-size: 10pt">FOR</span> /saptrx/eh_hdr-ao_system,
                s_aoid FOR /saptrx/eh_hdr-ao_id,
                s_aotype FOR /saptrx/eh_hdr-ao_type.
SELECTION-SCREEN <span style="font-size: 10pt">END</span> OF <span class="l1s521">BLOCK</span> b1.


INITIALIZATION.
  REFRESH s_system.
  s_system-low = 'SAPECC'.
  s_system-option = 'EQ'.
  s_system-sign = <span style="font-size: 10pt">'I'</span>.
  APPEND s_system.

START-OF-SELECTION.
  SELECT * <span style="font-size: 10pt">FROM</span> /saptrx/eh_hdr
    WHERE ao_system <span style="font-size: 10pt">IN</span> s_system AND
          ao_type   IN s_aotype <span style="font-size: 10pt">AND</span>
          ao_id     IN s_aoid.

*** EH Header Detail
    IF /saptrx/eh_hdr-eh_active = <span style="font-size: 10pt">'X'</span>.
      FORMAT <span style="font-size: 10pt">COLOR</span> COL_HEADING INTENSIFIED OFF.
    ELSE.
      FORMAT <span style="font-size: 10pt">COLOR</span> COL_NEGATIVE.
    ENDIF.
    WRITE:/ <span style="font-size: 10pt">'Order:  '</span>, s_aoid-low(10), 

            ' Line', s_aoid-low+<span style="font-size: 10pt">10</span>(6),

<span class="l1s331">            </span>' EH GUID:', /saptrx/eh_hdr-eh_guid.

*** EH Expected Events
    FORMAT <span style="font-size: 10pt">COLOR</span> COL_GROUP.
    SELECT * <span style="font-size: 10pt">FROM</span> /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 <span style="font-size: 10pt">' '</span> OR <span class="l1s331">'N'</span>.
          WRITE: <span style="font-size: 10pt">'Not expected'</span>.
        WHEN <span style="font-size: 10pt">'R'</span>.
          WRITE: <span style="font-size: 10pt">'Reported    '</span>.
        WHEN <span style="font-size: 10pt">'O'</span>.
          WRITE: <span style="font-size: 10pt">'Overdue     '</span>.
        WHEN <span style="font-size: 10pt">'E'</span>.
          WRITE: <span style="font-size: 10pt">'Expected    '</span>.
      ENDCASE.
      WRITE: <span style="font-size: 10pt">' Msg:'</span>,
          (20) /saptrx/eh_expev-msg_exp_date,
          (20) /saptrx/eh_expev-msg_rcvd_date.

    ENDSELECT.
    ULINE.

*** EH Event Messages
    SELECT * <span style="font-size: 10pt">FROM</span> /saptrx/eh_evmsg
      WHERE eh_guid = /saptrx/eh_hdr-eh_guid
      ORDER <span style="font-size: 10pt">BY</span> event_date_utc.

      IF /saptrx/eh_evmsg-not_relevant = <span style="font-size: 10pt">'X'</span>.
        FORMAT <span style="font-size: 10pt">COLOR</span> COL_NEGATIVE.
      ELSE.
        FORMAT <span style="font-size: 10pt">COLOR</span> COL_POSITIVE.
      ENDIF.
      WRITE: /(<span style="font-size: 10pt">20</span>) /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 <span style="font-size: 10pt">COLOR</span> COL_GROUP INTENSIFIED <span class="l1s521">ON</span>.
      SELECT * <span style="font-size: 10pt">FROM</span> /saptrx/evm_eem
         WHERE evt_guid = /saptrx/eh_evmsg-msg_guid.

        WRITE: /5 /saptrx/evm_eem-evtid(<span style="font-size: 10pt">20</span>),
                (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 <span style="font-size: 10pt">COLOR</span> COL_GROUP INTENSIFIED OFF.
      SELECT * <span style="font-size: 10pt">FROM</span> /saptrx/evm_par
         WHERE evt_guid = /saptrx/eh_evmsg-msg_guid.

        WRITE: /5  <span style="font-size: 10pt">''</span>.

        CASE /saptrx/evm_par-partyp.
          WHEN <span style="font-size: 10pt">'I'</span>.
            WRITE <span style="font-size: 10pt">'Info   '</span>.
          WHEN <span style="font-size: 10pt">'C'</span>.
            WRITE <span style="font-size: 10pt">'Control'</span>.
        ENDCASE.

        WRITE:  (<span style="font-size: 10pt">20</span>) /saptrx/evm_par-param_name,
                (20) /saptrx/evm_par-param_value.
        CASE /saptrx/evm_par-action.
          WHEN <span style="font-size: 10pt">'S'</span>.
            WRITE <span style="font-size: 10pt">'Insert'</span>.
          WHEN <span style="font-size: 10pt">'C'</span>.
            WRITE <span style="font-size: 10pt">'Change'</span>.
          WHEN <span style="font-size: 10pt">'D'</span>.
            WRITE <span style="font-size: 10pt">'Delete'</span>.
        ENDCASE.

      ENDSELECT.

      ULINE.

    ENDSELECT.

  ENDSELECT.

END-<span style="font-size: 10pt">OF</span>-SELECTION.

 

 

Kevin Wilson  Active Contributor Bronze: 250-499 points is a Sr. SAP Solution Engineer for QData USA Inc. and founder of ERPGenie.COM


Comment on this article
Comment on this weblog