on 11-06-2006 12:21 PM
Hi All,
Trying to fetch data from sap server using JCO,Below is the Code, and i am giving correct username, password and hostaddress.
i am unable to fetch the data from Sap server.
Function module ---ZLBSFUNCTION
Table name---- ZLBS_EMMOBILE
Name,Plotnum,City,State,Citycode,Country are the Field of the table...
Function Module is as Below
FUNCTION-pool ZLBSFUNCTION .
*"----
""Local Interface:
*" IMPORTING
*" VALUE(NAME) LIKE ZLBS_EMMOBILE-NAME
*" TABLES
*" ITAB STRUCTURE ZLBSEM
*"----
FUNCTION ZLBSFUNCTION.
*"----
""Local Interface:
*" IMPORTING
*" VALUE(NAME) LIKE ZLBS_EMMOBILE-NAME
*" TABLES
*" ITAB STRUCTURE ZLBSEM
*"----
SELECT NAME PLOTNUM STATE CITY CITYCODE COUNTRY FROM ZLBS_EMMOBILE into TABLE ITAB .
ENDFUNCTION.
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
Servlet code is as Below
IRepository repository;
try
{
// add a connection pool to the sap system
JCO.addClientPool(LBS,10,"100","USERName","Passwd","EN","Host name","00");
repository = JCO.createRepository("myRepository",LBS);// new repository
IFunctionTemplate ftemplate = repository.getFunctionTemplate("ZLBSFUNCTION");
JCO.Function function = new JCO.Function(ftemplate);
JCO.Client client = JCO.getClient(LBS);
JCO.ParameterList input = function.getImportParameterList();
client.execute(function);
JCO.Table dataTable = function.getTableParameterList().getTable("ZLBS_EMMOBILE");
for(int i=0;i<dataTable.getNumRows();i++){
dataTable.setRow(i);
if(dataTable.getString("Name")=="star"){
out.println(dataTable.getString("Name"));
out.println(dataTable.getString("Plotnum"));
out.println(dataTable.getString("City"));
out.println(dataTable.getString("State"));
out.println(dataTable.getString("Citycode"));
out.println(dataTable.getString("Country"));
} //end of if.
} //end of for
} //end of try
Would like to know anything Wrong with this Code,,, or anything Else That we need to code.........
Please help us....
Thanks and Regards
Preethi
Hi Preethi,
Can i know what is the error you are getting from the servlet.
Are you able to get the data from the Backend to Client.
Cheers,
Karthick
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi,
which type of error it is giving
regards
Guru
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
94 | |
11 | |
10 | |
9 | |
9 | |
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.