on 2008 Jun 26 12:49 PM
hi all,
I am new to caf development in DC i have created Application Service in that apllication service i have used an External service BAPI_FLIGHT_GETLIST and in that i have taken input parameter as Airlineid and based on that i am retreving the flightlist details inorder to print the output i have taken a list and after i am setting that list to retvalue.it is working fine but the problem iam facing is only one record is populated in the entire table i.e(first row is repeating) so for that i have used the fallowing code.......
BAPI__FLIGHT__GETLIST inp;
BAPI__FLIGHT__GETLIST_dot_Response out;
BAPI__FLIGHT__GETLISTLocal extref = this.getBAPI__FLIGHT__GETLIST();
inp = new BAPI__FLIGHT__GETLIST();
inp.setAIRLINE(airline);
try
{
out = new BAPI__FLIGHT__GETLIST_dot_Response();
out = extref.BAPI__FLIGHT__GETLIST(inp);
com.sap.testapplicationservice.extsrv.bapi__flight__getlist.output.FLIGHT__LIST fl;
fl = new com.sap.testapplicationservice.extsrv.bapi__flight__getlist.output.FLIGHT__LIST();
fl = out.getFLIGHT__LIST();
AbstractCollection fl_col;
Iterator fl_it;
com.sap.testapplicationservice.extsrv.bapi__flight__getlist.output.BAPISFLDAT fl_struct;
fl_col = (AbstractCollection)fl.getItem();
fl_it = fl_col.iterator();
output res = new output();
int count = 0;
retValue = new ArrayList();
while (fl_it.next()!=null)
{
fl_struct = (com.sap.testapplicationservice.extsrv.bapi__flight__getlist.output.BAPISFLDAT)fl_it.next();
res.setFldate(fl_struct.getFLIGHTDATE());
res.setDepttime(fl_struct.getAIRLINE());
res.setArrtime(fl_struct.getCITYFROM());
retValue.add(count,res);
count++;
}
}
catch (Exception e) {
// TODO: handle exception
System.out.println(e.getStackTrace().toString());
throw new ServiceException(e);
}
so plz help me out in solving this issue....
Hi Mahesh,
Your issue will be resolved if you create the object instance of output inside your while loop.
And after populating the values you have to make your output to null.
Code it like this
while()
{
output op = new output();
res.set................
res.set................
retValue.add(count,op);
op = null;
}
Thanks,
Chaitanya.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
66 | |
10 | |
10 | |
10 | |
10 | |
8 | |
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.