Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

CL_BCS...: Mail Header Fields?

UweFetzer_se38
Active Contributor
0 Kudos

Hello collegues,

Background:

On one hand we send emails to a large group of users (Solution Manager ITSM). As response the users can answer to these mails. The content of the answer will be stored in Solman tickets via a Mail-In interface.

The problem now is, that also ie. "Out-of-Office" notices are stored in the tickets.

Two possible solutions (will work in Exchange environment at least):

- outgoing: usage of Mail header field "X-Auto-Response-Suppress" -> no automatic "Out-of-Office" mail will be created

- inbound: read "X-Auto-Response-Suppress" header field (already in all "Out-of-Office" mails) -> ignore mail

My problem: I couldn't find a solution yet to read/set any Mail header fields.

Is it possible to get access to the Mail Header Fields via CL_BCS... or other workarounds?

Or do you have another idea to solve this problem?

Best regards and Thank you

Uwe

1 ACCEPTED SOLUTION

CarstenKasper
Active Contributor
0 Kudos

Hi Uwe,

I do not know about the mail handling in SolMan, but using BCS it should be quite possible to read the mail header.

If you do not have your mail as a BCS document yet, you could easily create it if you have the MIME data.

CL_DOCUMENT_BCS=>CREATE_FROM_MIME().

Now this same class does have a method

GET_UOBJHEAD()

that returns the mail header as an internal table.

In case you already have got a SEND_REQUEST you would first have to read the document and then cast it to CL_DOCUMENT_BCS and then get the header.

DATA:

  lr_document TYPE REF TO IF_DOCUMENT_BCS,

  lr_doc type ref to CL_DOCUMENT_BCS,

  lr_header type soli_tab.

lr_document = send_request->document( ).

lr_doc ?= lr_document.

lr_header = lr_doc->getu_objhead( 1 ).

Hope this helps. Have not tried the coding myself yet.

cheers Carsten

8 REPLIES 8

CarstenKasper
Active Contributor
0 Kudos

Hi Uwe,

I do not know about the mail handling in SolMan, but using BCS it should be quite possible to read the mail header.

If you do not have your mail as a BCS document yet, you could easily create it if you have the MIME data.

CL_DOCUMENT_BCS=>CREATE_FROM_MIME().

Now this same class does have a method

GET_UOBJHEAD()

that returns the mail header as an internal table.

In case you already have got a SEND_REQUEST you would first have to read the document and then cast it to CL_DOCUMENT_BCS and then get the header.

DATA:

  lr_document TYPE REF TO IF_DOCUMENT_BCS,

  lr_doc type ref to CL_DOCUMENT_BCS,

  lr_header type soli_tab.

lr_document = send_request->document( ).

lr_doc ?= lr_document.

lr_header = lr_doc->getu_objhead( 1 ).

Hope this helps. Have not tried the coding myself yet.

cheers Carsten

0 Kudos

Hello Carsten,

unfortunately it doesn't work, the object header is always empty.

I don't think, that the object header contains the mail header fields.

Documentation of FM SO_DOCUMENT_SEND_API1 (which uses the CL_BCS.. inside)

OBJECT_HEADER

    This table must contain the summarized data dependent on each object

    type. SAPscript objects store information here about forms and

    styles, for example. Excel list viewer objects store the number of

    rows and columns amongst other things and PC objects store their

    original file name.

But thank you though

Uwe

Former Member
0 Kudos

Hello Uwe,

I am assuming that the Exchange server is MS Exchange server. If you are using exchange server 2010 and 2007, There are a few web services which would help you in indentifying if a sender has an Out of office or not.

Have a look at the link below,  which explains the web service operation  in detail.

200&:

http://msdn.microsoft.com/en-us/library/exchange/aa563465(v=exchg.80).aspx

2010:

http://msdn.microsoft.com/en-us/library/exchange/aa563465(v=exchg.140).aspx

I guess you would be receiving these out of office emails  , within your corporate network

I hope this helps.

Thanks,

Venkat.

0 Kudos

Hi Venkat,

a really nice idea! If I would have the time, I'd implement it. Unfortunately the fix must be ready tonight.

We've decided on a quick fix: filter the incoming mails with subjects starting with "Automatic reply:"

Uwe

GrahamRobbo
Active Contributor
0 Kudos

Hi Uwe,

Maybe you can call the AS_MIME_MESSAGE of the class CL_SEND_REQUEST_BCS to get the raw inbound message.

Convert this from a xstring to a string and you could parse the result to extrtact the particular fields you are interested in.

Cheers

Graham Robbo

0 Kudos

Hi Graham,

already tried this. In the Mime part are only additional fields like Mime-type, encoding etc. and the message itself but not the header fields.

I think I'll give up and stay with the solution like I've mentioned above (subject).

Uwe

0 Kudos

That seems a bit strange because I can see these fields in this test I did with an email sent from GMail.

Received: by mail-ia0-f170.google.com with SMTP id i1so3038818iaa.15
 for ; Wed, 05 Dec 2012 15:49:55 -0800 (PST)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=google.com; s=20120113;
 h=mime-version:from:date:message-id:subject:to:content-type
 :x-gm-message-state;
 bh=pTqjOOtAB3JxWjEs66IbgR85KR0WpP9YGtg/TXmUtcw=;
 b=D9mV0WNto4SZdccPOi4afI+zt09ZCDMjyfuuB+Ke3OidiwPTJXvQuEsCzZy0483D/2
 zeT+87217zawuXq1oDWRGz8yfulLTehWOYebDyMFP5LNsc0BckYbNCnZBU+xgd3UUDSS
 MLQxWa7ryBX8NoHJJIyxLMrMqWhewnURhwkZnwAlxD1tQ/eOxayivkpi8yLti/+t9FT/
 Kw46qNtXrZYgHksHsbALo/LmkSrJkwlRv2fcpsz2bLrFfBrFvGAy+PpAQf+wwyhqaCah
 ew4/krBEjWwpZFky3z1QfJUc2VO0FyLRSeftFVj2Zbmph6VW3dNccwFjgfp+PvTeG5/r
 ndpw==
Received: by 10.50.53.193 with SMTP id d1mr3914941igp.69.1354751394962; Wed,
 05 Dec 2012 15:49:54 -0800 (PST)
MIME-Version: 1.0
Received: by 10.231.147.195 with HTTP; Wed, 5 Dec 2012 15:49:34 -0800 (PST)
From: Graham Robinson Date: Thu, 6 Dec 2012 10:49:34 +1100
Message-ID: Subject: this is the subject
To: wflow.test@dev.2-cliks.comContent-Type: multipart/alternative; boundary=f46d04339b1ca7dbd304d023a37d
X-Gm-Message-State: ALoCoQmfiaWTBNtdfiQH3RFCTzkUdsd2kB+DvzZZuQGQMZfTurK2Qjox2aOGKRSJIYF28Nua7awj

--f46d04339b1ca7dbd304d023a37d
Content-Type: text/plain; charset=ISO-8859-1

This is the body

--f46d04339b1ca7dbd304d023a37d
Content-Type: text/html; charset=ISO-8859-1

This is the body
--f46d04339b1ca7dbd304d023a37d--

Maybe MS Exchange works a different way?

0 Kudos

Strange, will try again on Monday. Unfortunately Solman mail address is not reachable from outside, so can't compare with gmail.