on 05-31-2007 12:32 PM
HI Experts,
I have a WD application. In this application, I have a MODEL that fetches data from my R/3 by executing a Function Module. The FM takes as IMPORT a parameter "INFTY" of Assosiated Type "T538C" with Default value as "0022". The FM returns a TABLE of Assosiated Type "T538T".
Now this function module gives the following output :
Hours
Days
Weeks
Months
Years
Semesters
Classes
I do the context mapping for the View with the Component Controller and the Component Controller with the Model. Now when I create a FORM (Apply Template) in the View based on the View Context, I change one of the attributes/fields (Zeinh) in the form to DropDownbyIndex to contain the following values fetched from the Function Module :
Hours
Days
Weeks
Months
Years
Semesters
Classes
When I execute the application, there are no values in the DROPDOWN.
Same thing when I do by Apply Template for a Table, all the values are being displayed in the table in seperate rows.
Here is the code in my View :
public void wdDoInit()
{
//@@begin wdDoInit()
Z_Ees_Get_Time__Unit_List_Input input = new Z_Ees_Get_Time__Unit_List_Input();
wdContext.nodeZ_Ees_Get_Time__Unit_List_Input().bind(input);
try {
wdContext.currentZ_Ees_Get_Time__Unit_List_InputElement().modelObject().execute();
} catch (WDDynamicRFCExecuteException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
//@@end
}
What am I missing ?
Regards
Saurabh
Dear,
For fetching the values from R/3 with dropdown i am using follwoing code. Try it. Its 100% workign for me.
public void populateDDL(String localContextAttribute, Node nodeSource, String keyField, String descField)
{
int intSize = 0;
ISimpleTypeModifiable objSimpleTypeEduTrngData = null;
IModifiableSimpleValueSet objSimpleValueSetEduTrngData = null;
String strKey = "";
String strDesc = "";
try
{
objSimpleTypeEduTrngData = wdThis.wdGetAPI().getContext().getModifiableTypeOf(localContextAttribute);
objSimpleValueSetEduTrngData = objSimpleTypeEduTrngData.getSVServices().getModifiableSimpleValueSet();
intSize = nodeSource.size();
objSimpleValueSetEduTrngData.clear();
if (intSize>0)
{
for (int i=0;i<intSize;i++)
{ /*
strKey = wdContext.nodeSource().getI_Edu_TraElementAt(i).getAusbi();
strDesc = wdContext.nodeSource().getI_Edu_TraElementAt(i).getAtext();
*/
strKey = nodeSource.getElementAt(i).getAttributeAsText(keyField);
strDesc = nodeSource.getElementAt(i).getAttributeAsText(descField);
objSimpleValueSetEduTrngData.put(strKey, strDesc);
}
}
}
catch (Exception e)
{
}
finally
{
objSimpleTypeEduTrngData = null;
objSimpleValueSetEduTrngData = null;
strKey = null;
strDesc = null;
}
}
to use this above code use follwing line like i have used -
populateDDL("Item_1_Drpdown", wdContext.nodeT_Zaccesory_Master_Output(),"Itemid","Item_Desc");
Revert back if any problem.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
The error tat you getting now is because of teh cardnality 1:n keep it 0:n
you can print the Size of the node by using the following code
wdThis.wdGetAPI().getComponent().getMessageManager().reportSuccess(wdContext.node<NodeName>().size()+"");
I guess the node size is 0.
Are you sure there are values if you execute the FM
AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Arjun,
Check the Cardinality of the node that you have binded to he the dropdown ,
Set it to 1..n
I think this will work
Regards
Shiva Prasath
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi All,
Thanks a lot for all your replies. But it doesnt seem to work still.
Naga Raju Meesala, wdContext.nodeOutput().invalidate(); -> Still doesnt fetch me any values, its still the same.
Avijit, wdContext.nodeOutput().invalidate(); -> Doesnt work.
Madhu, Check once you have binded your output node to DropdownByIndex value property. How do I check this ?
Anoop, Check whether the particular attribute that u bind with the dropdown has values in it. How do I check this ?
How do I print the size of the node ?
Im using dropdownbyindex, not dropdownbykey.
Im not using dropdowns inside table.
Shivaprasath, I set the Cardinality of the node that I have binded to the dropdown, to 1..n and it gave me this error.
The initial exception that caused the request to fail, was:
com.sap.tc.webdynpro.progmodel.context.ContextException: Node(Edu0705_newComp.Z_Ees_Get_Time__Unit_List_Input): cannot fill a ModelNode automatically. Change the cardinality or use a supply function.
at com.sap.tc.webdynpro.progmodel.context.Node.doSupplyElements(Node.java:452)
at com.sap.tc.webdynpro.progmodel.context.Node.supplyElements(Node.java:406)
at com.sap.tc.webdynpro.progmodel.context.Node.getElementList(Node.java:345)
at com.sap.tc.webdynpro.progmodel.context.Node.createMappedElementList(Node.java:498)
at com.sap.tc.webdynpro.progmodel.context.Node.setElements(Node.java:483)
... 39 more
Ravi,Do I need to have these methods in the Component Controller?
GetTime(), GetTimeInvalidate()
Sorry guys im new to webdynpro, so so many questions.
Plz help.
Regards
Saurabh
Hi,
Suppose your context structure is
+Z_Ees_Get_Time__Unit_List
--Z_Ees_Get_Time__Unit_List_Input
++Response
+++OutputNode
-
Attr1
The values that you need in the DropDownByIndex are in the attribute Attr1 of the node OutputNode
Now bind the texts property of DDBI to the context attribute Attr1.
Dont change the cardinality of the node.
public void wdDoInit()
{
//@@begin wdDoInit()
Z_Ees_Get_Time__Unit_List_Input input = new Z_Ees_Get_Time__Unit_List_Input();
wdContext.nodeZ_Ees_Get_Time__Unit_List_Input().bind(input);
try {
wdContext.currentZ_Ees_Get_Time__Unit_List_InputElement().modelObject().execute();
wdContext.nodeOutputNode.invalidate();
wdComponentAPI.getMessageManager.resportSuccess("Size of Output node "+wdContext.nodeOutputNode.size()); // this gives you size of the output node
} catch (WDDynamicRFCExecuteException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
//@@end
}
<b>By the way,isn't it a bad practice of executing the model inside the wdDoInit of the view.</b>
Hi Saurabh,
Put this code in Component Controller:
wdInit()
{
Z_Ees_Get_Time__Unit_List_Input input = new Z_Ees_Get_Time__Unit_List_Input();
wdContext.nodeZ_Ees_Get_Time__Unit_List_Input().bind(input);
}
Create a method GetTime()
{
try {
wdContext.currentZ_Ees_Get_Time__Unit_List_InputElement().modelObject().execute();
} catch (WDDynamicRFCExecuteException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
Create another Method GetTimeInvalidate()
{
Z_Ees_Get_Time__Unit_List_Input input = new Z_Ees_Get_Time__Unit_List_Input();
wdContext.nodeZ_Ees_Get_Time__Unit_List_Input().bind(input);
}
Call GetTimeInvalidate() method in View (Best place to call this action in InboundPlug or Action)
This will clear all your context and filled with new values
In View Controller:
InBoundPlug()
wdThis.YourControllerName().GetTime();
This will solve your problem
Thanks
ravi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Check whether the particular attribute that u bind with the dropdown has values in it...also check you are using dropdownbyindex, not dropdownbykey...
Try to print the size of the node so that you will come to know the size of teh dropdown..
also are you using dropdowns inside table???
AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Saurabh,
Check once you have binded your output node to DropdownByIndex value property.
Regards
Madhu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
just call the invalidate() methode on the output node of your Modelnode. If you don't invalidate the data will not come.
just write the following line in your current code just after the execute() method calling line.
wdContext.nodeOutput().invalidate();
The whole code will be like this:
public void wdDoInit()
{
//@@begin wdDoInit()
Z_Ees_Get_Time__Unit_List_Input input = new Z_Ees_Get_Time__Unit_List_Input();
wdContext.nodeZ_Ees_Get_Time__Unit_List_Input().bind(input);
try {
wdContext.currentZ_Ees_Get_Time__Unit_List_InputElement().modelObject().execute();
wdContext.nodeOutput().invalidate();
} catch (WDDynamicRFCExecuteException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
//@@end
}
Thanks and Regards
Avijit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hai,
invalidate the output node.
wdContext.nodeOutput().invalidate();
Regards,
Naga
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.