标签:sap ep 下拉条 netweaver web dynpro
/** 下拉条填充模板. */ //@@end public java.lang.String fillDropDownList( com.sap.tc.webdynpro.progmodel.api.IWDAttributeInfo attributeInfo, java.util.List v, java.lang.String label, boolean isShowDefault, boolean showCodeWithDesc ) { //@@begin fillDropDownList() String defaultValue = null; ISimpleTypeModifiable modifyType = attributeInfo.getModifiableSimpleType(); modifyType.setFieldLabel(label); IModifiableSimpleValueSet valueSet = modifyType.getSVServices().getModifiableSimpleValueSet(); valueSet.clear(); if (isShowDefault) { valueSet.put("", ""); } if (v != null) { for (int i = 0; i < v.size(); i++) { ValueSetItem item = (ValueSetItem) v.get(i); if (defaultValue == null && i == 0) { defaultValue = item.getId(); } if (showCodeWithDesc) { valueSet.put(item.getId(), item.getId() + " " + item.getText()); } else { valueSet.put(item.getId(), item.getText()); } } } return defaultValue; //@@end } //@@begin javadoc:fillTranstate() /** 运输状态下拉条填充. */ //@@end public void fillTranstate( com.sap.tc.webdynpro.progmodel.api.IWDAttributeInfo attrinfo ) { //@@begin fillTranstate() String defaultval = ""; List dropdownlist = new ArrayList(); dropdownlist.add(new ValueSetItem("0","计划")); dropdownlist.add(new ValueSetItem("1","完成计划")); dropdownlist.add(new ValueSetItem("2","登记")); dropdownlist.add(new ValueSetItem("3","装载开始")); dropdownlist.add(new ValueSetItem("4","装载结束")); dropdownlist.add(new ValueSetItem("5","装运完成")); dropdownlist.add(new ValueSetItem("6","装运开始")); dropdownlist.add(new ValueSetItem("7","装运终止")); defaultval = fillDropDownList(attrinfo, dropdownlist,attrinfo.getName(),true,false); //@@end }
把上面两个方法写在Component Controller或Custom Controller上,然后在对应的View上直接调用即可。
标签:sap ep 下拉条 netweaver web dynpro
原文地址:http://blog.csdn.net/imlanbin/article/details/43730383