Application Development and Automation 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: 
Read only

Jco clarification required

Former Member
0 Likes
1,142

Hi Guys,

I am calling a bapi from a java application using Jco. I have one doubt like do we need to maintain TCP/IP connection from SAP to that java application.

Because in jco coding itself we can give the login details of sap.

Thanks in advance.

Rgds,

Ram Sri

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,068

I don't think you need to do anything extra but yes java application should be able to access SAP system ( within the network ).

TCP/IP is a protocal and also a base for other protocals like RFC. You are already providing the RFC Connection details.

Cheers,

Ram

Hi Guys,

I am calling a bapi from a java application using Jco. I have one doubt like do we need to maintain TCP/IP connection from SAP to that java application.

Because in jco coding itself we can give the login details of sap.

Thanks in advance.

Rgds,

Ram Sri

8 REPLIES 8
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,068

In my experience, nothing was done on the SAP side to call BAPI via Jco. Everything was done on the java side.

Regards,

Rich Heilman

Read only

Former Member
0 Likes
1,069

I don't think you need to do anything extra but yes java application should be able to access SAP system ( within the network ).

TCP/IP is a protocal and also a base for other protocals like RFC. You are already providing the RFC Connection details.

Cheers,

Ram

Read only

0 Likes
1,068

Hi Ram,

If i am calling a Bapi from java application, i am giving sap logon details in jco programming like clinet, user id, password, hostname and system number.

But i am not maintaining any TCP/IP connection from SAP side? Then still it works???

Secondly how to handle the errors from both java application side and sap side if any error occurs?

Thanks in advancd.

Rgds,

Ram Sri

Read only

0 Likes
1,068

The way I think the connection is opened from your program. I am sure you must have created a connection and passing the login details from your program.

But I think you should search "JCO Connection" on sdn search to find more.

BAPI's will return you messages through it's BAPIRETURN parameter that you need to capture in your application.

Use the commit BAPI if it's successful ( No error messages in BAPIRETURN ).

Sorry I don't know much about JCO.

Cheers,

Ram

Read only

0 Likes
1,068

Ram,

If your Java application is always going to be the client, then you don't need to do anything on the SAP side. The logon parameters which you give in JCO is good enough. The connection is as good as you logging on to SAP using the GUI, except for the fact that there is no GUI in JCO.

Since you Java application is the client, it makes sense to handle all errors and logging in your application. Since you are using BAPI, your communication is syncronous and hence based on return parameter from the BAPI you can handle errors and write suitable logs.

TCP/IP connection in SM59 is required only if SAP is going to be the client and java application the server. That is, if your java application is to be made visible in SAP.

Hope this helps.

Thanks

KK

Read only

Former Member
0 Likes
1,068

HI ,

To use JCo to connect to SAP,

U don't have to do do anything on SAP side.

In NetWeaver devloper studio , create a java project.

In that, create new->other>sap_connectivity --sap enterprise connector

Give package name and a name for class

then on next screen , under tab single server give

host name

system number

client

logon name

password

language

This will lead to a screen where u can select the BAPI or function module which u want to use.

After selecting it will create the classes and methods required for Input , Port and Output .

In your program also you have to establish connection using Port Class , pass Input to the method and then get the OutPut.

Hence you don't have to do anytjing on the SDAP side as u are in a way logging on to SAP giving all the details like system , userid ,password

Regards,

Siddhartha

Read only

0 Likes
1,068

Hi Folks,

While giving sap logon parameters whatkind of user id should i give., i.e dialog, communication or service user id? Can somebody help me?

Rgds,

Ramgopal

Read only

0 Likes
1,068

Ram-

Use a Service user. Just make sure that RFC authorizations are available for this user. SAP provides standard profiles for RFC authorizations.

KK