08-07-2007 7:28 AM
Hi all,
I've just written a class that processes incoming emails and sends a reply, as per Thomas Jung's blog <a href="/people/thomas.jung3/blog/2004/09/09/receiving-e-mail-and-processing-it-with-abap--version-610-and-higher E-Mail and processing it with ABAP</a>. I've setup the inbound processing rule in transaction SO50, and set it to all recipients (I basically put *).
However, I didn't get a reply, which is what is meant to happen. I'm not sure if its the setup of the inbound processing rule. I basically copied and pasted Thomas' code so I don't think it's a problem with the class itself. Also, I've set the SMTP settings, and pointed it to an exchange server, just like the blog.
The class is activated and I tried to set an external breakpoint but it was never triggered. Does anyone know how to check if an inbound processing rule is being triggered?
Any help would GREATLY appreciated...
08-08-2007 2:52 PM
One option to get a breakpoint in code that is not executed directly is to code a type of (almost) infinite loop temporarily, and then use SM50 to enter debug mode for the code.
eg:
data: x type c.
do 500 times.
wait up to 1 second.
if x = 'X'.
exit.
endif.
enddo.
This will leave the process in SM50 for 500 seconds, which should enable you to select the line and go to debug. once in debug, set field x to 'X' to get out of the loop.
Andrew
08-08-2007 2:52 PM
One option to get a breakpoint in code that is not executed directly is to code a type of (almost) infinite loop temporarily, and then use SM50 to enter debug mode for the code.
eg:
data: x type c.
do 500 times.
wait up to 1 second.
if x = 'X'.
exit.
endif.
enddo.
This will leave the process in SM50 for 500 seconds, which should enable you to select the line and go to debug. once in debug, set field x to 'X' to get out of the loop.
Andrew
08-09-2007 1:12 AM
Hi Andrew,
I tried doing that, but the process did not turn up in SM50 at all. Does this mean that the exit is not being triggered? I'm not sure if I was meant to do something else to the class, as when I test it I get an error, but that could be because it requires an email to trigger it.
Any more ideas would be really helpful.
08-09-2007 4:05 AM
Joanna,
I have not set up inbound email, so am not sure what the issue might be. My answer on debugging was based on using this method with workflow and RFC calls.
I would guess that the code is not being executed if it does not show in SM50.
The only other suggestion I can make is to look in SAP log files to see if there is anything showing that might help. Transaction ST11 can be used to look at a lot of developer trace files. Also you can set Trace / Debugging / Recorder in transaction SICF to see what is happening there (see Edit menu).
Andrew
08-09-2007 7:18 AM
Hi Jo,
you can turn on tracing in transaction SCOT. The menu path is Utilities->Trace->Internal Trace. Select the 'Inbound On' radio button to start tracing. You display the trace file from the same screen.
It does sound to me like the class is not being called by the email handler. I would get rid of the wildcard '*' in your configuration and make it something very specific to try and figure out why it is not working.
I assume you have successfully delivered and email message to a SAP Office Inbox from an external sender? If this doesn't work then you may have an email routing problem or the SMTP configuration on your WAS might be incomplete.
Cheers
Graham
08-09-2007 7:28 AM
Hi Graham,
I have been trying to figure out if the problem is actually due to external emails not coming in properly. I have tested sending an email from my SAP inbox to an internet address with successful result, however I never managed to receive any from external emails.
I've setup my user with an email address that's on the exchange server, but I only receive emails sent to that address in my Outlook Express inbox. How can I check if I've setup SMTP properly for inbound emails?
Thanks so much in advance.
08-09-2007 7:37 AM
Hi Jo,
you certainly need to get mail routing working so emails are directed to your WAS server. This is almost certainly a job for your email administrator.
Generally what people do is create a new email domain for your SAP system. So for example it might be @sap.yourcompany.com (generally it is a subdomain of your usual email domain) and then have all emails for this domain routed to the SMTP server running on your WAS. In otherwords an email addressed to <i>jo@sap.yourcompanyname.com</i> might be forwarded to the host <b>sapserv.yourcomapnyname.com</b> and to port <b>25</b>.
Then you need to configure SCOT and maintain the email address in your User Master Record in SAP to match this new email domain.
The proof that all this works properly is that you can send an email from SAP Office to an external recipient, and they can reply to the message and have the reply delivered to SAP Office.
Now, in the meantime, you can actually simulate an incoming email message using telnet to talk directly to your SMTP server. Do a Google search to find instructions on how to do this. I found <a href="http://www.yuki-onna.co.uk/email/smtp.html">this one.</a>
This is a great way to test your code.
Cheers
Graham