Hi all,
I am working with nwds 7.2. When I am trying to set values to a structure in a bapi using list it gives code error, so I used abstract list. Please find below the structure and code:
structure:
Model UploadProdOrderModel
bapi Zbapi_Por_5003_Upload_So_Input
I->File_Table of structure type Zbapi_Por_5003_Table
collection cardinality as 0...n and selection cardinality as 0..1
I->Bapi_Input of structure type Zbapi_Por_5003_Input
collection cardinality as 0..1 and selection cardinality as 0..1
The code is as follows :
try
{
com.sap.crmb2b.uploadproductorder.model.UploadProdOrderModel modalVar = new com.sap.crmb2b.uploadproductorder.model.UploadProdOrderModel();
com.sap.crmb2b.uploadproductorder.model.Zbapi_Por_5003_Upload_So_Input requestVar = new com.sap.crmb2b.uploadproductorder.model.Zbapi_Por_5003_Upload_So_Input(modalVar);
Zbapi_Por_5003_Input in = new Zbapi_Por_5003_Input(modalVar);
Zbapi_Por_5003_Table tab= new Zbapi_Por_5003_Table(modalVar);
in.setSales_Org("1010");
in.setDist_Channel("00");
in.setDivision("00");
wdComponentAPI.getMessageManager().reportSuccess("1");
requestVar.setBapi_Input(in);
wdComponentAPI.getMessageManager().reportSuccess("2");
AbstractList<Zbapi_Por_5003_Table> listin = null;
wdComponentAPI.getMessageManager().reportSuccess("3");
tab.setMatnr("0101");
wdComponentAPI.getMessageManager().reportSuccess("4");
tab.setShipto("23324");
wdComponentAPI.getMessageManager().reportSuccess("5");
tab.setKwmeng("1");
wdComponentAPI.getMessageManager().reportSuccess("6");
tab.setSoldto("2345");
wdComponentAPI.getMessageManager().reportSuccess("7");
listin.add(tab);
wdComponentAPI.getMessageManager().reportSuccess("8");
requestVar.setFile_Table(listin);
wdComponentAPI.getMessageManager().reportSuccess("9");
requestVar.execute();
Error on execution:
while trying to invoke the method java.util.AbstractList.add(java.lang.Object) of an object loaded from local variable 'listin'
Thank you
Regards,
Preet Kaur