cancel
Showing results for 
Search instead for 
Did you mean: 

jco pass > 1 records into table structures

Former Member
0 Kudos

how to pass > 1 records into table structures

if i want to set 2 or more record at the same time like

First Record


goodsReturn.setMATNR("G651-BATT");
		goodsReturn.setMENGE(1.0);
		goodsReturn.setWERKS("WHQ0");
		goodsReturn.setSERNR("5000000053");
		goodsReturn.setLGORT("MAIN");
		goodsReturn.setKOSTL("EWL1413");
		goodsReturn.setGSBER("EWHQ");

second record


goodsReturn.setMATNR("LTP-2002");
		goodsReturn.setMENGE(1.0);
		goodsReturn.setWERKS("WHQ0");
		goodsReturn.setSERNR("5000000053");
		goodsReturn.setLGORT("MAIN");
		goodsReturn.setKOSTL("EWL1413");
		goodsReturn.setGSBER("EWHQ");

BELOW IS ONLY SET AND READ TO TABLE STRUCTURE 1 RECORD AT A TIME.........


GoodsReturn goodsReturn=new InvGoodsReturn();
		goodsReturn.setMATNR("G651-BATT");
		goodsReturn.setMENGE(1.0);
		goodsReturn.setWERKS("WHQ0");
		goodsReturn.setSERNR("5000000053");
		goodsReturn.setLGORT("MAIN");
		goodsReturn.setKOSTL("EWL1413");
		goodsReturn.setGSBER("EWHQ");
		try{
		Collection col=goodsReturn.directGoodsReturn();
		for(Iterator it=col.iterator();it.hasNext();){
			 GoodsReturn goodsRet = (InvGoodsReturn)it.next();
			 System.out.println(goodsRet.getMATNR()+"  "+goodsRet.getMENGE() +" " 
					 			+goodsRet.getSERNR()+" "+goodsRet.getZSUBRC()+"  "+goodsRet.getZEMSG());
			
		 }
		}catch(Exception ex){
			System.out.println("main: " +ex);
		}



//call function
JCO.ParameterList tabInput = function.getTableParameterList();
				JCO.Table inputTable = tabInput.getTable("ZOSBVBMSG");
				int k=inputTable.getNumRows();
				inputTable.appendRow();
				inputTable.setRow(0);
				System.out.println("checking table input:" +this.getMATNR()+"  " +this.getMENGE()+ " "
								+this.getWERKS()+" " +this.getSERNR()+" " +this.getLGORT() +" "
								+this.getKOSTL()+" " +this.getGSBER()+ " " +this.getVBELN());
				//inputTable.setValue(inputTable,"ZOSBIMSEG");
				inputTable.setValue(this.getMATNR(),"MATNR");
				inputTable.setValue(this.getMENGE(),"MENGE");
				inputTable.setValue(this.getWERKS(),"WERKS");
				inputTable.setValue(this.getSERNR(),"SERNR");
				inputTable.setValue(this.getLGORT(),"LGORT");
				inputTable.setValue(this.getKOSTL(),"KOSTL");
				inputTable.setValue(this.getGSBER(),"GSBER");
				inputTable.setValue(this.getVBELN(),"VBELN");
				
				int f=inputTable.getNumRows();
				
				 System.out.println("after set successful");
				 client.execute(function);	

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

Actually you can use JCO.Table's <i>appendRow(int num_rows)</i>. But you still have to loop through the rows and add values individually, like thus:

for (int i = 0; i < table.getNumRows(); i++) {
           table.set...;
}

If you are looking at adding a collection, maybe, then I don't think it's supported.

Regards,

Satyajit.