Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

jco pass > 1 records into table structures

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);	

Former Member
Not what you were looking for? View more on this topic or Ask a question