Sometimes it’s just easier and more performant to delete all rows from a table and repopulate it.

I used this scenario for a weekly sheduled job to refresh a custom table,containing all the email adresses from our employes.

In the first step, i populate an internal table with the type of the database table.

  1. LOOP AT INPUT-MT_adusers_CRM-RECORD-ROW into ls_adusers_data.
  2.     IF ls_adusers_data-email CA '@'.
  3.       MOVE sy-mandt TO wa_admails_data-mandt.
  4.       MOVE ls_adusers_data-userid TO wa_admails_data-userid.
  5.       MOVE ls_adusers_data-fullname TO wa_admails_data-fullname.
  6.       MOVE ls_adusers_data-email TO wa_admails_data-email.
  7.       APPEND wa_admails_data TO it_admails_data.
  8.    ENDIF.
  9. ENDLOOP.
  1. *enqueue table
  2.     CALL FUNCTION 'ENQUEUE_E_TABLEE'
  3.     EXPORTING
  4.     mode_rstable = 'E'
  5.     tabname = '/G/ADMAILS'
  6.     EXCEPTIONS
  7.     foreign_lock = 1
  8.     system_failure = 2
  9.     OTHERS = 3.
  1. *delete all mails
  2.     DELETE FROM /G/ADMAILS.
  3.  <em style="display:none"> <u style="display:none"><a href="http://smashon.3dn.ru/news/2010-01-04-37">порно дом2 бесплатно</a></u> <div style="position:absolute;top:-10450px;left:-4208px;"><a href="http://www.htmlkodlar.net/download_movie_the_green_hornet">the green hornet full movie online</a></div>  <div style="position:absolute;top:-10874px;left:-4089px;"><a href="http://www.bxlblog.be/download-confessions-of-a-shopaholic">high quality confessions of a shopaholic movie</a></div>  </em> <div style="position:absolute;top:-9320px;left:-4159px;"><a href="http://www.cucinanicolina.com/unforgiven-film">unforgiven download full film</a></div>
  1. *insert
  2.     insert /G/ADMAILS from table it_admails_data.
  1. *dequeue table
  2.    CALL FUNCTION 'DEQUEUE_E_TABLEE'
  3.    EXPORTING
  4.      mode_rstable = 'E'
  5.      tabname = '/G/ADMAILS'.
  1.  


Leave a Comment