There are several ways to do this, however I will point you to the Java technique. The JCo API comes with an implementation of an RFC server. This server allows you to register a Java object as an external program in an RFC destination. Your ABAP program can use this RFC destination like any other call function routine to retrieve data from an external datastore. See my tip on the JCo RFC server at SearchSAP.com.
Dig Deeper on SAP Java and J2EE
Related Q&A from Austin Sincock
How to provide an SAP R/3 4.5B application server with a Web service interface Continue Reading
A reader wants to know how to consume a Web service from an SAP 4.6c R/3 application server. Continue Reading
Are you a Java/J2EE developer interested in SAP? This expert tip lists the most relevant SAP modules and technologies for you. Continue Reading