Skip to Content
author's profile photo Former Member
Former Member

Automaticly create value attributes

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Oct 18, 2006 at 10:50 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.