cancel
Showing results for 
Search instead for 
Did you mean: 

Starting a JCo connection

Former Member
0 Kudos

I'd like to start a JCo connection from a handheld just to call a RFC and get some values. I can suppose the connection is on so I don't need to perform synchronization (that's exactly what I don't want ). How can I read user, password and server address from MI client?

Thanks a lot

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Castro....

<b>1.</b>I would recommend u to try this first in a WINDOWS 32(XP) system and then go for the Handheld...

develop ur JCO application from MDK in MI perspective...

<b>2.</b>Open a MI AWT project...

Go Java Biuld Path (Properties of ur project) add the JCO jars in the Project Library....

Now in the Design your UI for AWT perspective...

When u click submit button it should retive the value from RFC Backend...

To achieve this add this following code in appropiate place in ur project...

public void onclick-submit() {
				try {
			// Change the logon information to your own system/user
				mConnection = JCO.createClient("client(100)", // SAP client
		"username", // userid
		"password", // password
		null, // language
		"application server", // application server host name
	"instance number"); // system number
			mConnection.connect();
			mRepository = new JCO.Repository("dummy string", mConnection);
		} catch (Exception ex) {
			ex.printStackTrace();
			System.exit(1);
		}

<b>3.</b>for the better understanding go for the documants on JCO...

<b>4.</b>after u compelete ur project export the projact in a jar file and upload it in SAP webconsole for ur user...

Synchronize once to get the project to ur device...

NOw u dont have to synchronize any more it will fetch the value without syncing..

Regards,

Vijay..

Get back for more help...

Former Member
0 Kudos

I have already local storage of password but I don't wany user to ask for password other than on login to MI and I can't find any createClient function that doesn't ask for the password and uses the locally stored credentials.

Is it possible to do what I want?

Former Member
0 Kudos

hello rafa,

this might work, but is not recommended.

create your own login page and prior to forwarding the

request to the login servlet, you can take hold or

persist the posted username/password info. now when you

have to create the JCO.Client you can use the username

and password info that you have saved.

to create your own login page, you have to know all the

parameter names. you can try running MI and look on the

source code of the login page. you will find their names

in the form somewhere.

goodluck,

jo

Former Member
0 Kudos

I'll take that as a "no".

Thanks a lot. I think i'll have to exchange all data at sync time.

Former Member
0 Kudos

hello rafa,

i do agree with your decision.

another option is to use the generic sync framework.

i think it is the best way...

regards

jo

Answers (2)

Answers (2)

Former Member
0 Kudos

hey rafa

this is how the process takes place

1.first you need to create a FM at the backend with all your business logics.

2.the FM should be able to retrive the and update your DB.

3.create a wrapper for your FM.

4.if you are planning for generic sync then you need to create a data contaner. In case of smart sync the framework will take care of it.

5. this data container head will have your alias name for your wrapper which will be generated automatically when you create the wrapper.

6. the FM WAF_MWSYNC will take care of mapping your alias name to your wrapper which in turn calls your FM in the backend.

this is how the sync process works.

the creation of generic and smart sync can be found here

http://media.sdn.sap.com/public/html/submitted_docs/MI/MDK_2.5/index.htm

regs

Arun

Message was edited by: arun a v

Former Member
0 Kudos

hello rafa,

>How can I read user, password and server address from

>MI client?

1) getting the user info

use the com.sap.ip.me.api.user.UserManager &

com.sap.ip.me.api.user.User APIs.

User currentUser = UserManager.getInstance().getCurrentUser();
String userName = currentUser.getUniqueID();

2) getting the server address

use com.sap.ip.me.api.conf.Configuration and use the

synchronization related parameters.

(see <a href="http://help.sap.com/saphelp_nw04/helpdata/en/43/5cd7dc12092a21e10000000a422035/content.htm">General Parameters for Synchronization</a> for details)

String gwHostName=Configuration.getInstance().getProperty("MobileEngine.Sync.Gateway.Host");
String sapSystemName=Configuration.getInstance().getProperty("MobileEngine.Sync.Gateway.System");

the details of the SAP system is defined on the J2EE

<sysid>.props file. (see <a href="http://help.sap.com/saphelp_nw04/helpdata/en/92/0d603d13b5c72ee10000000a114084/content.htm">Creating Property Files</a> for details)

3) regarding the sync password

generally, the local logon to MI client and the sync

password used for MW login is different. sync password

is being asked by the MI framework during the synchronization

invocation and the framework does not hold a copy of it

persistently due to security measures. however, you have

an option of using the your local logon password as your

MW logon password by enabling the local logon support

settings in the client (see <a href="http://help.sap.com/saphelp_nw04/helpdata/en/43/5d29cb28616e47e10000000a422035/content.htm">Parameters for Security and Authentication</a> for details).

you local logon password is stored within the User info

managed by the UserManager and is encrypted. MI does not

offer any method for retrieving the local password... so

you should be specifying the password into your JCo

invocation...

hope this helps

jo