on 10-19-2007 1:39 PM
Hello Friends,
I have one inputfield and value attribute in view, now I have extended my controller, add a new value attribute with the same name, and mapped them, when I run the applicatin, got the following exceptin :
must not modify the datatype of a mapped attribute
Any idea what I am doing wrong
PS: Both have type string...
Hello Murtuza,
Unfortunately, this did not worked out for me,
Nevertheless, I have passed the inputfield value in method parameter in controller, ....so for time being it has solved the issue...
Regards, ( points awarded for your kind help and supprot ....
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
"must not modify the datatype of a mapped attribute ", this error comes in following cases.
(1) You are making your inputfield as valuehelp field by creating SVS or EVS.
Solution: Move all calculation to component controller.
(2) DataType Problem: Like java.util.Date and java.sql.date both refer's to date
Solution:Check the import Packeges in such case.
Regards,
Praveen
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Praveen,
Thanks for your input,...
Yes the input field is with f4 help, and the value of this input field I want to handover to my controller, and therefore i did bindng, and encountered the exception:
You mentioned by I have to shift the calculation to controller, ( right now my all coading for f4 help on inputfield is in doModifyInit.... what do u mean by calculation to move to controller ?
Seconldy, is there anyother way to fix this issue ?
Regards,
In doinit of view, I have following code:
( varname is the inputfield, and the value of this inputfield I want to bind with value attribute of the controller...)
IWDAttributeInfo attribute_var = wdContext.getNodeInfo().getAttribute("varname");
ISimpleTypeModifiable fileName_var = attribute_var.getModifiableSimpleType();
What I can do to fix this issue ?
Regards,
hi this is all code in wdinit of view:
fileName_var.setFieldLabel("varname");
IModifiableSimpleValueSet valueSet2 = fileName_var.getSVServices().getModifiableSimpleValueSet();
for (int i = 0; i < wdContext.nodeVartab().size(); i++)
{
valueSet2.put(wdContext.nodeVartab().getVartabElementAt(i).getVarname(), "Variant: " + wdContext.nodeVartab().getVartabElementAt(i).getVarname());
}
valueSet2.sort(true, true , true);
.... the thing is the nodeVartab is not avaiable in that custom controller, ( as I have two custom controller )....
Hello,
I have shifted the code from view to the custom controller, the problem is solved, i.e I am not getting anymore the exception, but the new problem is that the f4 help is not avaiable to my input filed...
looks like the inputfiled is not recognize in the custome controller ....
pls help....
Regards,
PS: if its helpful I can paste my code.....
Message was edited by:
Shah H
IWDAttributeInfo attribute_var = wdContext.getNodeInfo().getAttribute("varname");
ISimpleTypeModifiable fileName_var = attribute_var.getModifiableSimpleType();
this above code I have shifted from view to my custom controller, now the thing is varname is the attribute which I have in view and also in controller ( which I want to mapped from view to controller )
so pls suggestn, how I can manage to bring the varname here from view ?
IWDAttributeInfo attribute_var = wdContext..(context from view)..getNodeInfo().getAttribute("varname");
how I can access the context from view here ?
Regards,
Okey, here I will let you know what I have done uptill now:
(I have couple of views with two custome controllers and 4 models:)
The following code was in my view first.
IWDAttributeInfo attribute_var = wdContext.getNodeInfo().getAttribute("varname");
ISimpleTypeModifiable fileName_var = attribute_var.getModifiableSimpleType();
Zport_Get_Variant_Input variant_input = new Zport_Get_Variant_Input();
wdContext.nodeZport_Get_Variant_Input().bind(variant_input);
variant_input.setClient(wdContext.currentContextElement().getClient());
variant_input.setPuser(wdContext.nodeZport_Get_Fields_Input().getZport_Get_Fields_InputElementAt(0).getUname());
//variant_input.setRpttype(wdContext.currentContextElement().get.getReportType() );
variant_input.setTabname(wdContext.currentContextElement().getTabname());
try {
wdContext.nodeZport_Get_Variant_Input().currentZport_Get_Variant_InputElement().modelObject().execute();
wdContext.nodeVartab().invalidate();
} catch (Exception e ) {
}
fileName_var.setFieldLabel("varname");
IModifiableSimpleValueSet valueSet2 = fileName_var.getSVServices().getModifiableSimpleValueSet();
for (int i = 0; i < wdContext.nodeVartab().size(); i++)
{
valueSet2.put(wdContext.nodeVartab().getVartabElementAt(i).getVarname(), "Variant: " + wdContext.nodeVartab().getVartabElementAt(i).getVarname());
}
valueSet2.sort(true, true , true);
Which I then moved to my one custome controller : before doing that, I have created a value attribute varname in controller to be mapped with varname of my view ( which takes the values from inputfiled ) by doing so I got the exception, which was fixed when I moved the above mentioned code from view to controller.
Now the new issue is f4 help is not visible in inputfield. you mentioed something with type ? but my both context attributes are of type string...
Yes, you can edit it directly. It would be disabled because you have mapped it to your controller too.
Do one thing. Remove both the context from view as well as from the controller and create new one in your <b>controller</b> with the same name that you gave previously. Specify the type to the Simple Type. Now map the same to your view too.
Regards,
Murtuza
hi
After executing RFC try to add this code
IWDAttributeInfo[] ovsStartUpAttributes =
{ wdContext.nodeUser_Input_Node().getNodeInfo().getAttribute("varname")};
IWDOVSContextNotificationListener listener =
wdThis.wd<UR>CompController().getListener();
WDValueServices.addOVSExtension("Var Name",
// not used yet by the current OVS Service
ovsStartUpAttributes,
// fields bound to startup attributes will be ovs-enabled
wdThis.wd<UR>CompController().getInputNode(),
wdThis.wd<UR>CompController().getOutputNode(),
listener);
Write getListener() getInputNode () and getOutputNode() methos in component controller.
one last confusion :
While doing point 5: I have to first create the value attribute (varname )in view, assign it to my inputfield and then I can mapped it with my custom controller ? right ...
and while creating varname in view I will create it of type simpletype, created first....
secondly, by doing so, I do not need to shift my all code form view to controller ( for creating f4 help )...
Regards,
Still getting the following exception:
com.sap.tc.webdynpro.progmodel.context.ContextException: MappedAttributeInfo(SelectView.varname): must not modify the datatype of a mapped attribute
I have not created the value attribute of type simpletype in customcontroller, mapped it to view, and inputfield, ( the coading for creating f4 help is in view ),
PLS help, how I can fix the issue, without moving the code creating f4help in custom controller ? ( because while do so, I fell in further issues )
Regards,
Hi,
What I understood is :
You have an input field in your view binded to a context(not model context) of simple type and thus acting as F4 in your view.
You are getting the values from your back-end R/3 system.
You are dynamically adding those values to your simple type enumeration from your model nodes.
If this is the scenario then you don't have to map the context binded to input field to your custom controller.
If my understanding is wrong then point me whereever there are changes.
Regards,
Murtuza
Hello Murtuza,
Thanks for your help ; but I am still facing the issue to give over the value of my inputfield to the custom controller, ( now both the value attributes are of simpletype )
or let me ask in other way, how I can access the context of view in my custom controller ?
right now I am trying following to access the varname in controller:
wdContext.currentContextElement().getVarname()
Any idea....
Regards,
<b>You are dynamically adding those values to your simple type enumeration from your model nodes.</b>
Apart of this all is okey, ...
After getting the userinput in inputfield, I want to give over this value to the controller, .....so I just want to know how I can handover the inputfield value to custom controller...
Regards,
<b>If you need to access your view context in your custom controller then there needs to be a mapping between your view and controller.
Once you map it to your custom controller, you will be able to access it using:
wdContext.currentContextElement().getVarname()</b>
This is the problem i.e. when I do mapping, I got the exception as said earlier...
com.sap.tc.webdynpro.progmodel.context.ContextException: MappedAttributeInfo(SelectView.varname): must not modify the datatype of a mapped attribute
Regards,
Message was edited by:
Shah H
Message was edited by:
Shah H
Hi,
I tried to write the same code in component controller and was getting the values for the input box successfully.
The only thing is you need to map the view and component controller but the code for populating the values to the simple type will be written in component controller instead of the view.
I tried this and is working for me.
Regards,
Murtuza
Yes for you it would be custom controller.
I created a context attribute called Comp of Simple type String.
This is the code I placed in the custom controller's method.
IWDAttributeInfo attr = wdContext.getNodeInfo().getAttribute("Comp");
ISimpleTypeModifiable sim = attr.getModifiableSimpleType();
IModifiableSimpleValueSet vs = sim.getSVServices().getModifiableSimpleValueSet();
vs.put("Value1","Key_1");
vs.put("Value2","Key_2");
Regards,
Murtuza
okey, here is what I am doing:
This is the code in view which is used to create the f4 help, ( now I moved this to doinit of custome controller )
IWDAttributeInfo attribute_var = wdContext.getNodeInfo().getAttribute("varname");
ISimpleTypeModifiable fileName_var = attribute_var.getModifiableSimpleType();
Zport_Get_Variant_Input variant_input = new Zport_Get_Variant_Input();
wdContext.nodeZport_Get_Variant_Input().bind(variant_input);
variant_input.setClient(wdContext.currentContextElement().getClient());
variant_input.setPuser(wdContext.nodeZport_Get_Fields_Input().getZport_Get_Fields_InputElementAt(0).getUname());
variant_input.setTabname(wdContext.currentContextElement().getTabname());
try {
wdContext.nodeZport_Get_Variant_Input().currentZport_Get_Variant_InputElement().modelObject().execute();
wdContext.nodeVartab().invalidate();
} catch (Exception e ) {
}
fileName_var.setFieldLabel("varname");
IModifiableSimpleValueSet valueSet2 = fileName_var.getSVServices().getModifiableSimpleValueSet();
for (int i = 0; i < wdContext.nodeVartab().size(); i++)
{
valueSet2.put(wdContext.nodeVartab().getVartabElementAt(i).getVarname(), "Variant: " + wdContext.nodeVartab().getVartabElementAt(i).getVarname());
}
valueSet2.sort(true, true , true);
But still the f4 help is not there, ......
PS: the varname is avaiable twice 1) in view with simpletype string, and 2) in custom controller with simpletype string ?
Dont know what I am doing wrong....
have u also created the comp in view and in controller ?
Regards,
I created Comp in Custom Controller and mapped the same to view too.
So you first delete varname from view as well as custom controller and then create one in custom controller and map the same to view.
Write the following code in custom controller and I think you should find luck this time.
Regards,
Murtuza
Hi Shaw
You can not modify the mapped Attribute which is binded to the Input field.
Create One more Attr dont map with the component controller Attr.Bind this to input field.
Populate the data from this Attr to the one Which you binded with Comp Controller.
Note :you can not modify the mapped Attr in Webdynpro like modifying into Simple type to use it as EVS or SVS.
Regards
Kalyan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Did you write some code that modifies the DDIC type of the attribute in the view controller? If yes, move that code to the component controller and modify the original attribute.
Armin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.