cancel
Showing results for 
Search instead for 
Did you mean: 

How to retrive data from sap

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi

i've just posted something that was some like in the same direction.

in case of a single recordset

the way you've put it

ret=function.getExportParameterList().getInt(

"EMPLOYEENUMBER");

what if im supposed to retrieve multiple records.

all employees hired on a particular date.

Regards,

Answers (0)