cancel
Showing results for 
Search instead for 
Did you mean: 

URGENT:CAF

Former Member
0 Kudos
90

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....

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

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.

Answers (0)