Home > SAP software/management Tips > SAP ABAP/Java developer tips > An introduction to the JCo server
SAP Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

An introduction to the JCo server


Austin Sincock
Rating: -3.25- (out of 5)

I am often asked how to call Java objects from within an ABAP application. Although this functionality is included in the JCo API, it is not easy to implement. My upcoming book Enterprise Java for SAP provides an in-depth tutorial application. However, in this tip, I will point you in the right direction for building your own JCo server.

Everything you need to create a JCo server is already available in the JCo download zip provided by SAP. The zip file includes several tutorial applications that show you how to build a sample server. Unfortunately, these examples are not documented very well, so the best way to learn the server is to play with the actual Java classes.

To start with, check out the directory <JCO_INSTALL>/demo for all of the included tutorial Java class files. The files you are interested in are Example5.java and Example7.java. Before running these applications, you must create an RFC destination in SAP that uses a registered server program called 'JCO...


RELATED CONTENT
SAP ABAP/Java developer tips
How to do additional dialog processing after SAP COMMIT WORK statement
How to find a piece of SAP ABAP code without debugging
How to read an SAP transaction in an ABAP code
How to provide an SAP R/3 4.5B application server with a Web service interface
How to find owners and transports of deleted ABAP programs
Fixing a common OPEN_FORM and START_FORM error in SAPscript
Select Text fields: Case-insensitive
Is this the quickest way to find a BADI?
Easily debug error messages in SAP processes
Accessing private attributes in ABAP Objects

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary


SERVER01'. Once this destination exists, compile and execute one of these classes from the command line and JCOSERVER01 will register itself to the specified RFC destination.

You can now write an ABAP application that calls this registered server program at the RFC destination to access some basic Java object functionality from within SAP. Review the example files to determine the appropriate import/export parameters and structures for each Java class.

Unlike other types of JCo development, the JCo server API requires that you extend the JCO.Server base class within your own server class. JCO.Server provides access to the key methods that must be overriden to provide access from within the SAP system.

In order to implement the JCO.Server, you must override at least the handleRequest() method. This describes how to handle import parameters from the ABAP application and processes export parameters for return to the ABAP program. handleRequest() takes a JCO.Function instance that describes the function structure, similar to the structure definition found in the SAP Function Builder. In fact, you can create shell RFC structures in SAP to describe the external interface implemented in the JCo server.

You will also need to implement one of the JCO.Server's default constructors. This constructor calls the JCO.Server superclass and loads the actual server based your specific SAP system parameters and a JCO.Repository. This repository can be generated by SAP, if your external interface has been defined there, or you can create your own JCO.Repository with only the external interfaces used by the server. See the JCo examples for a demonstration of custom JCO.Repositorys.

Finally, you will need a server startup class that passes in the appropriate SAP system values to the server startup method. In the JCo examples, this startup class is implemented internally in each classes' main() method. Hopefully, this will point you in the right direction for deploying a JCo server. Again, this is a fairly complex topic that is not easily approached through a single tip. However, there are some nuggets of gold buried within the JCo download that should get you going with a JCo server development.

Author Austin Sincock is a freelance Java/SAP consultant who contributes regularly to Web and print journals. He can be reached at austin@opensourceguru.com. Check out his upcoming book Enterprise Java for SAP

Rate this Tip
To rate tips, you must be a member of SearchSAP.com.
Register now to start rating these tips. Log in if you are already a member.


Submit a Tip




DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



NetWeaver SAP White Papers
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 2000 - 2010, TechTarget | Read our Privacy Policy
SearchSAP.com is a search service provided by TechTarget and is completely
independent of and not affiliated with SAP AG.
  TechTarget - The IT Media ROI Experts