on 11-04-2006 7:25 AM
HI,
I have a value node and model node in my current view. say view1. the model node is mapped to custom controller model node which executes bapi initialy to retrieve data from r/3. now i want to assign values in my valued node to retrieve data. and i want to check the size of the model node. my value node has recursive node and some value attributes which is mapped to table. i want to set the value node value attirbutes as the values of model node which is available in current view itslef.
I used following code it displays only description not the exact value.
newDElement = node.createDElement();
node.addElement(newDElement);
newDElementnt.setValone(wdContext.currentBapiDesc().getDescription());
suggest me for the solution.
regards,
Ganesh.D
hi,
Please reframe your question and elaborate it more.
Ashutosh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I have value node and model node in current view. model node is mapped to custom controller which retrieves r/3 data. i want assign current iview model node attribute to value node's attribute.
ex. valuenode1.id = modelnode1.id
id is attribute of valuenode1 and modelnode1.
modelnode1 is mapped to custom controller modelnoted2.
regards,
Ganesh.D
Hi Ganesh,
If the names of the attributes of the value node and the model node is exactly same, then you can use WDCopyService class's copyCorresponding method. This will copy the values from and to similarly named context attributes.
Go through the documentation
<a href="https://media.sdn.sap.com/javadocs/NW04/SPS15/wd/com/sap/tc/webdynpro/progmodel/api/WDCopyService.html">here</a>.
Regards,
Satyajit.
Hi Ganesh,
Use the foll code to copy from a model node to a value node. It will copy all fields, whose names are similar. You can put this as a generic method, taking ModelNode and ValueNode as input parameters. They are of type com.sap.tc.webdynpro.progmodel.api.IWDNode
IWDNodeElement elemSrc;
IWDNodeElement elemDest;
int size = ModelNode.size();
for (int i = 0; i < size; i++) {
ModelNode.setLeadSelection(i);
elemSrc = ModelNode.getCurrentElement();
elemDest = ValueNode.createElement();
ValueNode.addElement(elemDest);
WDCopyService.copyCorresponding(elemSrc, elemDest);
}
Regards,
LM
Hi LM
Just to simplify your code a bit
IWDNodeElement elemSrc;
IWDNodeElement elemDest;
int size = ModelNode.size();
for (int i = 0; i < size; i++) {
<b>elemSrc = ModelNode.getElementAt(i);</b>
elemDest = ValueNode.createElement();
ValueNode.addElement(elemDest);
WDCopyService.copyCorresponding(elemSrc, elemDest);
}
BR
Sergei
User | Count |
---|---|
82 | |
10 | |
10 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.