Skip to Content
I would like to complete the various thread regarding inbound/outbound mail.

As derscribe in webBlog Receiving E-Mail and processing it with ABAP – Version 610 and Higher and similar, you can put the code for manage email directly in class that process the mail. Unfortunatly is difficult to monitor process and keep in trace. You can use the class cl_trace_bcs, but if you want to debug it you need to define a infine loop and get it from SM50.

So I develop a simple solution that give you the (probabily) final solution.

We define a single class that take and process the inbound mail and save it on db. After that a standard programm will take the mail from db and process them for any activity you need (for example to create activity, to attach file, to process a “system command”)

Here the code for the class that take into db the mail:

And the code for the report that fisicaly process the mail.

You can enanche this by adding a raise event for immediate processing and a lock mecchanism to prevent duplicate read and process from db.

To report this post you need to login first.

3 Comments

You must be Logged on to comment or reply to a post.

  1. Gregor Wolf
    Hello Emmanuele,

    thank you for this blog. It sounds like a good Idea and I tried to implement it on our SAP CRM 4.0 based on Web AS 6.20. Unfortunately the Type DSWP_NOTIF_CREATE_TEXT is unknown. Can you please provide me the Basic type of the Element? Also you forgot the comma’s in the definition of type ZSYN_MAIL_INFO for the class.

    Best regards
    Gregor

    (0) 
    1. Emmanuele Prudenzano Post author
      Hi Gregor.
      You have right on both two question.
      1. I forgot comma becouse on my system I define it as dictionary structure.
      2. The element of DSWP_NOTIF_CREATE_TEXT is a table type of TDLINE. You can replace with TSFOTABL.

      Best regards
      Emmanuele

      (0) 
  2. Emmanuele Prudenzano Post author
    I forgot to add a little piece of code that allow you to get the “next” free number for export on db:

    In your class define this method or include this “inline”

    method GET_FREE_INDX.

      data: id type indx-SRTFD.

      select MAX( SRTFD ) into id
             from indx
             where RELID = ‘ZM’.
      IF sy-subrc eq 0.
        number = id+10.  ” the first 10 char is non numeric.
        add 1 to number.
      else.
        number = 1.
      endif.

    endmethod.

    Thanks to all.
    Emmanuele Prudenzano

    (0) 

Leave a Reply