Skip to Content
0
Former Member
May 19, 2005 at 07:56 PM

Question on value help

36 Views

I want to create a value help for populating the cost center when creating a requisition. I am trying to derive the cost center list from a bapi Bapi_Costcenter_Getlist.

This is what I did so far. In the custom controller wdDoInit method, I have the following code:

Bapi_Costcenter_Getlist_Input inputCC = new Bapi_Costcenter_Getlist_Input();

wdContext.nodeBapi_Costcenter_Getlist_Input().bind(inputCC);

wdThis.executeBapi_CostCenterList();

In the executeBapi_CostCenterList() method I have the following code:

wdContext.currentBapi_Costcenter_Getlist_InputElement().modelObject().execute();

In the view controller, I created a value node (Test) under which I created a value attribute (CostCenter). I am then binding this value attribute to input field UI element corresponding to the cost center.

The code I have in the wdDoInit method of the view controller is

ITestElement newElement = wdContext.createTestElement();

ISimpleTypeModifiable myType=wdThis.wdGetAPI().getContext().getModifiableTypeOf("Test.CostCenter");

IModifiableSimpleValueSet values=myType.getSVServices().getModifiableSimpleValueSet();

ICostcenter_ListElement thisl1;

int cnt = wdContext.nodeCostcenter_List().size();

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

thisl1 = wdContext.nodeCostcenter_List().getCostcenter_ListElementAt(i);

String costcenter = thisl1.getCostcenter();

values.put("Key_" + i, costcenter);

}

values.put("TestKey", "TestValue");

wdContext.nodeTest().addElement(newElement);

wdContext.currentTestElement().setCostCenter("Key_0");

The wdContext.nodeCostcenter_List().size() is 0.

What am I doing wrong?

Please help

Sriram