Shared Top Border

Enterprise Resource
Planning Portal

 

Advertise | Founder BLOG

ERPGenie.COM ABAP Tips and Tricks Database

THE ultimate
ERP website

 

Forums | Vote for us |

Google    Other Search Options

Login

Login to view more content!!!





Lost Password?
No account yet? Register

Registered Access

Poll

What area of ABAP are you interested in?
 
Home arrow Sample Code arrow ABAP Reports arrow Undelete an Event Handler in SAP EM
Undelete an Event Handler in SAP EM PDF Print E-mail
User Rating: / 0
PoorBest 
Written by Kevin Wilson   
Wednesday, 11 June 2008
This program is a utility to flag an Event Handler as deleted or undelete an EH that is already deleted.

REPORT  zundelete_eh.
*&---------------------*
*& Report ZUNDELETE_EH
*&---------------------*
TABLES : /saptrx/eh_hdr, /saptrx/apptalog.
************************
*           Selection-screen.
SELECTION-
SCREEN 

  BEGIN OF BLOCK id 

  WITH FRAME TITLE text-004.


SELECT-OPTIONS:
  s_ao_tp  
FOR /saptrx/eh_hdr-ao_type,
  s_tridtp 
FOR /saptrx/eh_hdr-trackingidtype,
  s_trid   
FOR /saptrx/eh_hdr-trackingid.
SELECTION-
SCREEN END OF BLOCK id.

* management data
SELECTION-
SCREEN 

  BEGIN OF BLOCK mgmt 

  WITH FRAME TITLE text-006.


SELECT-OPTIONS :
  s_crdl 
FOR /saptrx/eh_hdr-created_by,
  s_crdh 
FOR /saptrx/apptalog-tadate NO-EXTENSION,
  s_crtl 
FOR /saptrx/apptalog-tatime NO-EXTENSION.


PARAMETERS : 

  p_actonl AS CHECKBOX,
  p_delete 
like /saptrx/eh_hdr-eh_deleted.
SELECTION-
SCREEN END OF BLOCK mgmt.


TYPES

  tstamp_tab 

   TYPE RANGE OF /saptrx/eh_hdr-created_date,
  t_active

   TYPE RANGE OF /saptrx/eh_hdr-eh_active,
  ty_eh_hdr_tab 

   TYPE STANDARD TABLE OF /saptrx/eh_hdr.


DATA : p_crdt TYPE tstamp_tab,
       it_guids 
TYPE /saptrx/eh_guid_tab,
       wa_guid 
TYPE /saptrx/eh_guid_str,
       it_active 
TYPE t_active WITH HEADER LINE,
       t_delete 
type /SAPTRX/EH_DELETE.

AT SELECTION-SCREEN ON BLOCK mgmt.

  
PERFORM get_time_stamp.

****
*           Initialization.
****
INITIALIZATION.
  
PERFORM initialization.

****
*           START-OF-SELECTION.
****
START-
OF-SELECTION.
  t_delete = p_delete.
  
PERFORM set_active.
  
PERFORM get_guids.
  
PERFORM update_deletion.
  
commit work.
*&---------------------*
*&      Form  get_time_stamp
*&---------------------*
FORM get_time_stamp .
  
DATA

    l_time_range TYPE /saptrx/timestamp_range.

  
CALL FUNCTION '/SAPTRX/CONVERT_DATE_TIME'
    
EXPORTING
      i_time_low       = s_crtl-low
      i_time_high      = s_crtl-high
    
IMPORTING
      e_timestamp      = l_time_range
    
CHANGING
      i_date_low       = s_crdh-low
      i_date_high      = s_crdh-high
    
EXCEPTIONS
      validation_error = 
1
      
OTHERS           = 2.
  
IF sy-subrc <> 0.
    
MESSAGE ID sy-msgid 

            TYPE sy-msgty 

            NUMBER sy-msgno
       
WITH sy-msgv1 sy-msgv2 

            sy-msgv3 sy-msgv4.
  
ENDIF.

  
IF l_time_range IS NOT INITIAL.
    
APPEND l_time_range TO p_crdt.
    
CLEAR  l_time_range.
  
ENDIF.

ENDFORM" get_time_stamp


*&---------------------*
*&      Form  initialization
*&---------------------*
FORM initialization .
  s_crtl-
sign = 'I'.
  s_crtl-option = 
'BT'.
  s_crtl-low = 
'000000'.
  s_crtl-high = sy-uzeit.
  
APPEND s_crtl.

  s_crdh-
sign = 'I'.
  s_crdh-option = 
'EQ'.
  s_crdh-low = sy-datum.
  
APPEND s_crdh.
ENDFORM" initialization


*&---------------------*
*&      Form  set_active
*&---------------------*
FORM set_active .
  it_active-
sign   = 'I'.
  it_active-option = 
'EQ'.
  it_active-low    = 
'X'.
  
APPEND it_active.
  
IF p_actonl = space.
    it_active-
sign   = 'I'.
    it_active-option = 
'EQ'.
    it_active-low    = 
' '.
    
APPEND it_active.
  
ENDIF.
ENDFORM.  " set_active


*&---------------------*
*&      Form  get_guids
*&---------------------*
FORM get_guids .

  
DATA : lt_guids   TYPE /saptrx/eh_guid_tab.

  
REFRESH it_guids.
  
IF ( s_tridtp IS NOT INITIAL OR
           s_trid   
IS NOT INITIAL ).
    
SELECT eh_guid
      
FROM /saptrx/eh_trkid
      
INTO TABLE it_guids
      
WHERE trackingidtype IN s_tridtp
        
AND trackingid     IN s_trid.
    lt_guids = it_guids.
    
REFRESH it_guids.
  
ENDIF.

  
IF s_ao_tp IS NOT INITIAL.
    
IF lt_guids[] IS INITIAL.
      
SELECT eh_guid
        
FROM /saptrx/eh_qryid
        
INTO TABLE it_guids
       
WHERE ao_type IN s_ao_tp.
    
ELSE.
      
SELECT eh_guid
        
FROM /saptrx/eh_qryid
        
INTO TABLE it_guids
         
FOR ALL ENTRIES IN lt_guids
       
WHERE eh_guid = lt_guids-eh_guid
         
AND ao_type IN s_ao_tp.
    
ENDIF.
    lt_guids = it_guids.
    
REFRESH it_guids.
  
ENDIF.
  
IF lt_guids[] IS INITIAL.
    
SELECT eh_guid
      
FROM /saptrx/eh_hdr
      
INTO TABLE it_guids
      
WHERE eh_active    IN it_active
        
AND created_by   IN s_crdl
        
AND created_date IN p_crdt
        
AND trackingidtype IN s_tridtp.
  
ELSE.
    
SELECT eh_guid
      
FROM /saptrx/eh_hdr
      
INTO TABLE it_guids
       
FOR ALL ENTRIES IN lt_guids
      
WHERE eh_guid = lt_guids-eh_guid
        
AND eh_active    IN it_active
        
AND created_by   IN s_crdl
        
AND created_date IN p_crdt
        
AND trackingidtype IN s_tridtp.
  
ENDIF.
*  it_guids = lt_guids.
ENDFORM" get_guids