cancel
Showing results for 
Search instead for 
Did you mean: 

Need the list of USERS in SAP

Former Member
0 Kudos

Hi All

Can anyone tell me how to get the List of USERS persented in SAP SERVER using Java code.

If so plz provide me some sample code.

Its Very Urgent.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi

the list of users is maintained @ USR02 table. so, you can use the following SQL query to retrive the info..

...

java.sql.Statement stmt = con.createStatement();

ResultSet rs = stmt.executeQuery("<query>");

while (rs.next()) {

// retrieve and print the values for the current row

String s = rs.getString("<value>");

System.out.println("ROW = " + i + " " + s + " " + f);

}

replace the above query with this.. .

select BNAME from USR02 where MANDT=<client number>;

;;;

use the above query..in the JAVA code and display the list.

hope this info helps!

with BR,

Rajesh.

<i>award suitable points</i>

Former Member
0 Kudos

Hi,

Can you send me the full code, becaz i don't know, how to creation a connection to SAP Server from Java using JDBC concept.

As of now i am using the JCO concept to create connection from java to sap server.

Former Member
0 Kudos

Hi

// Now attempt to create a database connection

Connection db_connection =

DriverManager.getConnection (url, "dba", "sql");

// Create a statement to send SQL

Statement db_statement = db_connection.createStatement();

// Execute query

ResultSet result = db_statement.executeQuery

("select * from employee");

// While more rows exist, print them

while (result.next() )

{

// Use the getInt method to obtain emp. id

System.out.println ("ID : " + result.getInt("ID"));

// Use the getString method to obtain emp. name

System.out.println ("Name : " + result.getString("Name"));

System.out.println ();

}

please go thru this link..

http://java.sun.com/docs/books/tutorial/jdbc/overview/index.html

or

http://www.javacoffeebreak.com/articles/jdbc/

or

http://java.sun.com/docs/books/tutorial/jdbc/basics/index.html

with regards,

Rajesh.

<i>

award suitable points</i>

Former Member
0 Kudos

Hi,

My Doubt is at the starting of thye program only,

what are the Driver class and the URL to connect to SAP.

PLZ provide me this info

Regds

Raj

Former Member
0 Kudos

Hi Raj,

please go thru this url..

http://help.sap.com/saphelp_erp2005vp/helpdata/en/50/e48de299e7e94cb3caa9f7db1bc10b/frameset.htm

hope this info helps you!

with Regds,

Rajesh.

<i>pls, award points</i>

Former Member
0 Kudos

R u done with this job?

Swathi