cancel
Showing results for 
Search instead for 
Did you mean: 

Automaticly create value attributes

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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

http://www.sam-solutions.net

Former Member
0 Kudos

So the RFC structure name is the name of the bapi?

Answers (0)