cancel
Showing results for 
Search instead for 
Did you mean: 

Table values from R3

Former Member
0 Kudos

Hi,

This is on webdynpro java on NWDS7.0.

I have 10 fields(say,employee records) in R3 -get values from R3-populate into a table in the view. First 9 fields i take from R3 but the 10th field(say,percentage field) must be binded to a context created myself and then bound to the R3 node. i tried the below but i dont get the expected value:

code:

NODE: Percentage_NA:

{

IPrivateXXXView.IPercentage_NAElement newPrtgElement;

int tableData = wdContext.nodeBAPI().size();

for(int i=0;i<tableData;i++){

String prcntg = wdContext.currentBAPI().getZpercentage();

newPrtgElement = wdContext.createPercentage_NAElement();

newPrtgElement.setPercentage_na(prcntg);

wdContext.nodePercentage_NA().addElement(newPrtgElement);

wdContext.nodePercentage_NA().bind(newPrtgElement);

wdContext.nodeBAPI().moveNext();

}

-


RESULT: i get all values same in the output, though i used moveNext().

AnyHelp???

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member214651
Active Contributor
0 Kudos

Hi,

Try the following steps:

1. create a value node in the component controller of the WD project say "TableNode"

2. Copy the attributes from the RFC output node and paste them under the "TableNode"

3. After the model is executed, write the below code to copy all the 9 values from RFC node to "TableNode"

//This will copy all the 9 values from Model node to the Value node. No need of a for loop
//Make sure the name and type of the attributes in both Source and target node should be same, else the values will not be copied. Make sure u perform step 2 properly. Do not create on your own
WDCopyService.copyElements(wdContext().node<ModelOutputNodeName>(), wdContext().nodeTableNode());

4. Create 10th attribute under the "TableNode" say "percentage".

5. Write the below code after copying the elements

int tableNodeSize = wdContext().nodeTableNode().size();
for(int i = 0; i < tableNodeSize; i++)
{
    ITableNodeElement tableNodeElement = wdContext().nodeTableNode().getTableNodeElementAt(i);
    <type> <object> = tableNodeElement.get<attributeName>();
    if(condition)
    {
         tableNodeElement.setPercentage(<value>);
    }
}

6. Create a context binding for the TableNode in the View from the controller and bind it to the table

This will work

Regards,

Poojith MV

Former Member
0 Kudos

Thanks Poojith.

I am on my way trying your code, as the clients server is down, i am getting deployment errors.

anyways your solution seems to be helpful, thanks a lot dude....

appreciate your quick reply!!!

-

Suman