Application Development and Automation 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: 
Read only

Read Email Content

Former Member
0 Likes
4,868

Hi Guys,

I have to create a RFC function module that will check all the emails send in correspondence to the Sales order. The Sales order number will be a part of the email subject to that will be the search criteria.

I can get these details from table SOOD but I am unable to get the email address of the sender and the email address of the recipients of that email.

From where I can fetch the email address of the email recipients?

Once I got that then how can i read the content of the email?

Thanks

Regards

/Manik

4 REPLIES 4
Read only

suresh_datti
Active Contributor
0 Likes
1,664

check the code behind the tcode SOST.. you might find the relevant tables..( SOST,SOOS etc)

~Suresh

Message was edited by: Suresh Datti

Read only

Former Member
0 Likes
1,664

Hi Manik,

recipient you can find in the table SOES (using creation time SNDDAT + SNDTIM), field MSGV1.

To get a mail content I am using the class CL_DOCUMENT_BCS, certain objno from tables SOST/SOOS is precondition. Try following code:

DATA: document TYPE REF TO CL_DOCUMENT_BCS.

DATA: mail_content TYPE BCSS_DBPC.

DATA: im_soodk TYPE SOODK.

DATA: line(255) TYPE C.

im_soodk-objtp = 'RAW'.

im_soodk-objyr = '31'.

im_soodk-objno = '000000001000'.

CALL METHOD cl_document_bcs=>GETU_INSTANCE_BY_KEY

EXPORTING

i_sood_key = im_soodk

i_no_enqueue = 'X'

RECEIVING

result = document.

*now getting mail text in mail_content

CALL METHOD document->IF_DOCUMENT_BCS~GET_BODY_PART_CONTENT

EXPORTING

im_part = '1'

RECEIVING

re_content = mail_content.

LOOP AT mail_content-cont_text INTO line.

WRITE: / line.

ENDLOOP.

Advantage: no IMPORT FROM DATABASE, raw fields, cluster table handling necessary.

Regards, Alex

Message was edited by:

Alexander Ippa

Read only

0 Likes
1,664

Alexander, do you know how to do that without using BCS?

My release doesn't have it and I have to read the contents of some emails too...

Read only

Former Member
0 Likes
1,664

hi manik,

u can use the following code to get an email id.

DATA: p_objid TYPE swhactor-objid,

w_email TYPE ad_smtpadr.

CLEAR w_email.

  • To determine the email ids

CALL FUNCTION 'FTR_CORR_CHECK_EMAIL_SAP_USER'

EXPORTING

i_user = p_objid "(User ID)

IMPORTING

e_email_address = w_email

EXCEPTIONS

mail_address = 1

determination_error = 2

OTHERS = 3.

IF sy-subrc EQ 0.

write: w_email .

ENDIF.