on 10-18-2006 10:47 AM
Hi,
Is there a way to create automaticly value nodes and attributes in NWDS. The bapi only provides me the fieldname, -index en value. so it is only a table dumb of the r3 back-end.
So I want the field values automaticly be created as an value attribute in a value node. So one way or an other I have to extract the data from the table into NWDS
S.,
Yes, this is possible.
First, create empty value node in context, name it for example DynamicNode. Next, iterate over rows in table and dynamically add attributes:
wdContext.getContext().reset(false);
final IWDNodeInfo niDynamic = wdContext.nodeDynamicNode().getNodeInfo();
for (int i = 0; i < rfcTable.size(); i++) {
final <RfcStructureName> row = (<RfcStructureName>)rfcTable.get(i);
niDynamic.addAttribute(row.getFieldname(), "ddic:com.sap.dictionary.string");
/* above is string type used, other possible as well:
integer, double, date, time, boolean etc
*/
}
Finally, iterate RFC table once again and create element:
final IWDNodeElement entry = wdContext.nodeDynamicNode().createElement();
for (int i = 0; i < rfcTable.size(); i++) {
final <RfcStructureName> row = (<RfcStructureName>)rfcTable.get(i);
entry.setAttributeValue(row.getFieldname, row.getValue());
}
wdContext.nodeDynamicNode().addElement(entry);
Valery Silaev
SaM Solutions
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.