on 12-26-2007 9:51 AM
Hi all,
I created backend connection to Sap system.Now i want to retrive data from sap.Here i will give one EmpNo as input.Based on that input Ename and dateof join details has to be retrived from sap.
can anyone plz tell me how to get the data from table
The code i used is
JCO.Table codes = function.getTableParameterList().getTable("COMPANYCODE_LIST");
After this wat i have to do...
I am having all my EmpNo and Ename and otherdetails in that table.
I want to give EmpNo as Input and show the details of that particular employee on the screen
Regards
Padma N
have a look at this code
modify according to your needs
IRepository repository;
public int getPernr(String user)
{
int ret = 0;
double pool = Math.random();
//the repository we gonna be using
try{
// Add a connection pool for the specified system
JCO.addClientPool(
"", //alias for this pool
,
//max. number of connections
"", //SAP client
"", //userid
"", //password
"", //language
"", //host name
"" //system number
);
// Create a new repository
repository = JCO.createRepository(
"MYRepository", "test1"+pool);
}
catch(JCO.Exception ex) {
wdThis.wdGetAPI().getComponent().getMessageManager().reportSuccess(
"Exceptionwwwwwwx"+ex.getMessage());
}
//
JCO.Client client =
null;
try{
// Get a function template from the repository
System.out.println(
"start");
//wdThis.wdGetAPI().getComponent().getMessageManager().reportSuccess("ExceptWWWW");
JCO.Function function = repository.getFunctionTemplate(
"CRIF_GET_EMPLOYEE_FOR_USER").getFunction();
//wdThis.wdGetAPI().getComponent().getMessageManager().reportSuccess("ExceptioWWW");
// Fill in input parameters
JCO.ParameterList input = function.getImportParameterList();
input.setValue(user,
"USER_NAME" );
//input.setValue(String.valueOf(new Date()), "BEGINDATE" );
//input.setValue(String.valueOf(new Date()), "ENDDATE" );
// Get a client from the pool
//wdThis.wdGetAPI().getComponent().getMessageManager().reportSuccess("ExceptionQQ");
client = JCO.getClient(
"SB1");
//wdThis.wdGetAPI().getComponent().getMessageManager().reportSuccess("Exception");
// Execute function the remote system
client.execute(function);
System.out.println(
"2");
// Print return message
ret=function.getExportParameterList().getInt(
"EMPLOYEENUMBER");
System.out.println(
"3");
System.out.println(
"RETURN MESSAGE: " + ret);
}
catch(Exception ex) {
System.out.println(
"Caught an exception333: " + ex);
}
finally{
// Always release client !!!
JCO.releaseClient(client);
}
//try
return ret;
}
reward points if helpful
Bala
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.