‎2006 Sep 04 1:21 PM
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
‎2006 Sep 04 1:51 PM
check the code behind the tcode SOST.. you might find the relevant tables..( SOST,SOOS etc)
~Suresh
Message was edited by: Suresh Datti
‎2006 Nov 21 10:35 AM
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
‎2007 Jun 13 3:01 PM
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...
‎2006 Nov 21 11:18 AM
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.