cancel
Showing results for 
Search instead for 
Did you mean: 

How to connect SAP System(ECC) and get the data data from RFC/BAPI using JAVA + in Eclipse.

vijay_kumar49
Active Contributor
0 Kudos

Hello All

How to connect SAP System(ECC) and get the data data from RFC/BAPI using JAVA + in Eclipse.

is it possible to run the same application into the Tomcat server using eclipse.

Regards

Vijay

Accepted Solutions (0)

Answers (2)

Answers (2)

HAL9000
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Vijay,

I remember that you already participated here in this forum in the past with trying to help other users having JCo questions and you posted JCo code and examples.

How is it possible then that you are asking now how to do RFC and BAPI calls from Java?

The SAP Java Connector (JCo) is offered exactly for this purpose.

You can download the standalone version for usage scenarios outside of SAP NetWeaver AS Java environments from here:

http://service.sap.com/connectors

Please also see note 1077727.

The same JCo business application code can then also run in Tomcat. But I don't know if there are also eclipse plug-Ins for direct Tomcat integration or if the application deployments must be done manually.

I strongly recommend NOT deploy the JCo itself into an Web Application Server environment but to add the JCo libraries to the server startup classpath instead or to install it centrally as a separate library which can be referenced from all using applications. Avoid that the JCo library is loaded multiple times, otherwise you will probably get native library loading errors on following attempts to use JCo.

Best regards,

Stefan

PS: I assume that you know that Tomcat is offering a servlet container only.

vijay_kumar49
Active Contributor
0 Kudos

can you tell me full path for download (sapjco3.jar and sapidoc3.jar) under http://service.sap.com/connectors

HAL9000
Product and Topic Expert
Product and Topic Expert
0 Kudos

Please see note 1077727.

vijay_kumar49
Active Contributor
0 Kudos

I

I downloaded sapjco3.jar file and added under build path in NWDS7.3. I am trying to implement this below code. But I’m unable to see the JCO.Client

JCO.Client connClient = null;

IRepository mRepository; //taken from j2ee\cluster\dispatcher\bin\ext\com.sap.mw.jco\jrfc.jar

    

connClient = JCO.createClient("<SAP Client>","<UserId>","<Password>","EN","<Application server host name>","<system number>");

try {

     connClient.connect();

     }

catch (Exception ex)

     {

          ex.printStackTrace();

          System.exit(1);

     }

     mRepository = new JCO.Repository("Hell", connClient);

     JCO.Function strHELLO = mRepository.getFunctionTemplate("ZCI_PRICE_CHECKER").getFunction();

     JCO.ParameterList importParam = strHELLO.getImportParameterList();

     importParam.setValue(val,"EV_MAKTX"); // get the data from FM.

     try {

          connClient.execute(strHELLO);

     }catch (JCO.AbapException ex)

               {

               }

Can you pls. provide me proper API for this and help me on this requirement.

MarkusTolksdorf
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Vijay,

you are using the API of JCo 2.1. JCo 3.0 has a new API that is working differently. Simply have a look at the samples included in the archive you downloaded how communication is done now or look at the comparison in the migration guide, which is available from https://service.sap.com/connectors -> SAP Java Connector -> Tools & Services

Best regards,

Markus

HAL9000
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Vijay,

do you remember this thread? :

I have problem in fetch data from sap to java | SCN 

BTW, the SAP NW AS Java environment is still capable to serve the old JCo2 API. However, this is deprecated since 2007 and I strongly recommend to use the new JCo3 API also in the NW AS Java environment now. Especially for new developments.

In a standard eclipse environment (or in Tomcat) there is no other choice than to use the JCo3 API now.

Best regards,

Stefan

vijay_kumar49
Active Contributor
0 Kudos

Thanks for your reply

Is it possible to develop Vijay Dudla'a

MarkusTolksdorf
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Vijay,

RFC_READ_TABLE should not be used for security reasons.

Best regards,

Markus

HAL9000
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Vijay,

yes, from the technical perspective, it's of course possible to migrate this program from using JCo2 to JCo3. How the code needs to be adapted is explained in the JCo2 -> JCo3 Migration Guide that Markus mentioned above.

But I fully agree to Markus that the RFM RFC_READ_TABLE should not be used for security reasons. SAP recommends to use official BAPIs or write own RFMs which offer the needed business case specific functionality, but not a generic one that is capable of accessing database tables directly from outside.

Best regards,

Stefan

vijay_kumar49
Active Contributor
0 Kudos

Instead of RFM RFC_READ_TABLE.I'll use my FM.

I'm unable to download the JCo3.Jar file from SMP. If u have Jar files kindly forward to my mail: kallurivijay.sapep@gmail.com

Kindly help me.

HAL9000
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Vijay,

the SAP Java Connector is not free software.

But every SAP customer and partner gets an S-User ID with access to the SAP Marketplace. Please ask your local SAP Administrator (inhouse) for getting such an S-User ID with appropriate download permissions. You do not need an extra authorization from SAP.

The download is free for all customers and partners.

Best regards,

Stefan

vijay_kumar49
Active Contributor
0 Kudos

One more doubt

sapjco3.jar and JCo3.jar both are same or different. if Same, i have the sapjco3.jar file but its doesn't have JCO.Client and IRepository

HAL9000
Product and Topic Expert
Product and Topic Expert
0 Kudos

There is no official file named JCo3.jar. The SAP Java Connector 3.0 archive is named sapjco3.jar and offers the JCo3 API. And it doesn't contain JCO.Client and IRepository because these classes belong to the old SAP Java Connector 2.x, and were packaged in a file named sapjco.jar.

vijay_kumar49
Active Contributor
0 Kudos

Can you pls. provide me the path for download sapjco.jar in SMP.

http://service.sap.com/connectors

SAP Java Connector-----TOOLS & SERVICES------ Its available all SAP JCo.3 Jar files only

Microsoft Windows and Windows Server:

32bit SAP JCo 3.0.15 as zip file (5.424 KB), August 2, 2016
64bit Itanium SAP JCo 3.0.15 as zip file (6.303 KB), August 2, 2016
64bit x86 SAP JCo 3.0.15 as zip file (5.468 KB), August 2, 2016
MarkusTolksdorf
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Vijay,

2.1 has been out of support for about 3 1/2 years now, hence you can no longer download it on this download page.
Again: Please use JCo 3.0.

Best regardds,

Markus

vijay_kumar49
Active Contributor
0 Kudos

But sapjco3.jar files doesn't have  JCO.Clinet class.

MarkusTolksdorf
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Vijay,

yes, because JCO.Client was only part of JCo 2.1 API. JCo 3.0 has a different concept using JCoDestination. Simply use migration guide of 3.0 to understand how it has been replaced.

Best regards,

Markus

vijay_kumar49
Active Contributor
0 Kudos

Any update on above thread

former_member191044
Active Contributor
0 Kudos

Tomcat is just servlet container. I assume you will need EE Container to do so. I don't think you will get that to work.

Regards,

Tobias