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: 

Access Outlook inbox through ABAP

vaishali_singh
Explorer
0 Kudos
1,179

Hi,

I have a requirement to built a functionality to read a particular inbox in outlook through ABAP code so as to process the data in ECC as per the subject lines of the emails received. Can someone help me how to do it ?

Regards

Sammy

1 ACCEPTED SOLUTION

Marian_Zeis
Active Contributor
980

Best way is to use an API.

You can use the Microsoft Graph API to access everything around Office. I´ve used it to access calendars.
https://learn.microsoft.com/de-de/graph/api/resources/mail-api-overview?view=graph-rest-1.0
We wrote our own implementation but you can use this
https://github.com/microsoft/ABAP-SDK-for-Azure

6 REPLIES 6

FredericGirod
Active Contributor
0 Kudos
980

Outlook is a client email. You probably need to access a Server email.

First you need to know the available protocol of this server : SMTP, POP3, IMAP ...

Marian_Zeis
Active Contributor
981

Best way is to use an API.

You can use the Microsoft Graph API to access everything around Office. I´ve used it to access calendars.
https://learn.microsoft.com/de-de/graph/api/resources/mail-api-overview?view=graph-rest-1.0
We wrote our own implementation but you can use this
https://github.com/microsoft/ABAP-SDK-for-Azure

0 Kudos
980

Do you have sample code to use Microsoft Graph API to access Outlook ?

0 Kudos
980

Hi vaishali_singh ,

i don´t have the code anymore.

But we were using this approach:

https://blogs.sap.com/2020/12/18/configuring-oauth-2.0-and-creating-an-abap-program-that-uses-oauth-...

0 Kudos
980

Thanks for your help !!

0 Kudos
980

To access the Outlook inbox through ABAP (Advanced Business Application Programming), you can use the SAP Exchange Connector (SXC) framework. The SXC framework allows you to connect to various email servers, including Microsoft Exchange, and perform actions on the inbox such as reading emails, creating new emails, and managing folders. Here are the steps to access the Outlook inbox through ABAP using the SXC framework:

Ensure that the SXC framework is installed and configured in your SAP system. The SXC framework provides the necessary classes and functions to interact with email servers.

Use the CL_BCS class in ABAP to create a connection to the email server. Instantiate an instance of the CL_BCS class and set the properties such as the server address, credentials, and protocol (IMAP or POP3) for accessing the Outlook inbox.

Use the CREATE_DOCUMENT method of the CL_BCS class to create an email object. Set the necessary attributes such as sender, recipient, subject, and body of the email.

Use the SEND method of the CL_BCS class to send the email. This will connect to the Outlook server, authenticate the user, and send the email from the specified sender to the specified recipient.

Use the GET_INBOX method of the CL_BCS class to retrieve the list of emails in the Outlook inbox. This will return a collection of email objects that you can loop through and process as needed.

Perform any additional actions on the emails, such as reading the content, marking it as read, moving to folders, or deleting it.

Greetings,
Peter