cancel
Showing results for 
Search instead for 
Did you mean: 

Deleting a DropDownByKey value

Former Member
0 Kudos

Hello,

I have a requirement in the ESS Banks application where I need to remove a particular Payment Method option from the DropDownByKey field....is it possible to loop thrugh the values and delete that particular option ...I tried using the WDDropDownListBoxSize but don't know exactly how to use it..

Any help would be highy appreciated.

Accepted Solutions (0)

Answers (3)

Answers (3)

nikhil_bose
Active Contributor
0 Kudos

I think you can iterate through the node which is binded to DDByKey element, and delete the particular element containing specified value.

revert back if you have further doubts

nikhil

Former Member
0 Kudos

Thanks for the reply....actually the DropDownByKey element is not bound to a Node rather than bound to a Model Node Attribute....how can I iterate through it then....?

nikhil_bose
Active Contributor
0 Kudos

Iterate through Model node is not a problem, but deleting the value is not possible.

What we can do is create a value node and populate whatever values you need and that node bind to DDByKey.

nikhil

Former Member
0 Kudos

Shikhil,

As nikhil pointed, you can not delete value from model node;

But you can use an attribute node; copy the model node to the newly created node and bind that with the UI element (DropdownByKey);

From the node that is binded with the UI element, you may be able to delete the data.

Try this.

Regards

Vinod V

Former Member
0 Kudos

Hi Shikhil,

You can try the following:

IModifiableSimpleValueSet ValueSet = wdContext().node<nodeName>().getNodeInfo().getAttribute(IPublic<ComponentName>.I<NodeName>Element.<ATTRIBUTE_NAME>).getModifiableSimpleType().getSVServices().getModifiableSimpleValueSet();

    valueSet.remove(<key>);

Regards,

Gopal

Former Member
0 Kudos

Hello Gopal,

Thanks for the reply...I tried the line of code you specified but then I get the following Exception :

com.sap.tc.webdynpro.progmodel.context.ContextException: MappedAttributeInfo(DetailView.SelectedInfotype.Zlsch): must not modify the datatype of a mapped attribute

at com.sap.tc.webdynpro.progmodel.context.MappedAttributeInfo.getModifiableSimpleType(MappedAttributeInfo.java:117)

at com.sap.xss.hr.per.us.bank.detail.DetailView.wdDoModifyView(DetailView.java:186)

at com.sap.xss.hr.per.us.bank.detail.wdp.InternalDetailView.wdDoModifyView(InternalDetailView.java:704)

at com.sap.tc.webdynpro.progmodel.generation.DelegatingView.doModifyView(DelegatingView.java:78)

at com.sap.tc.webdynpro.progmodel.view.View.modifyView(View.java:337)

... 29 more

Please help.

Former Member
0 Kudos

Hi Shikhil,

That is because the attribute that you are trying to manipulate with is in some node of view which in itself is mapped to a node in Component Controller. So you have to manipulate the attribute which is in Component Controller. You cannot get ModifiiableSet of an attribute in view if it is mapped to some attribute of controller.

That is why when you are trying to get valueSet in the code, you are getting such error. This is the reason why I had specified the code as IPublic<ComponentName>. I<NodeName>Element.<ATTRIBUTE_NAME> instead of

IPrivate<ViewName>.

I<NodeName>Element.<ATTRIBUTE_NAME>

Regards,

Gopal

Former Member
0 Kudos

Hi Shikhil,

And one more thing I want to add. If possible do not manipulate the Node data in wdModifyView. This method is more specifically used for dynamic UI generation. According to Phase model philosophy (which I am not well versed with), the manipulation of node data, if possible, must not be done in wdModifyView.

Regards,

Gopal

Former Member
0 Kudos

Hi Shikhil,

I was wrong in one aspect. Please modify the code as follows:

IModifiableSimpleValueSet valueSet = 
wdThis.wdGet<ComponentController().
wdGetContext().node<nodeName>().
getNodeInfo().
getAttribute(IPublic<ComponentName>.I<NodeName>Element.<ATTRIBUTE_NAME>).
getModifiableSimpleType().
getSVServices().
getModifiableSimpleValueSet();

valueSet.remove(<key>);

Instead of accessing Context node of View, you must access Context node of Component controller to get the ModifiableSet reason for which I had already discussed in previous messages. Sorry for providing incorrect code earlier.

Regards,

Gopal

Former Member
0 Kudos

Thanks again...but still I am getting the same error....

Former Member
0 Kudos

Hi,

Why dont you go for the option that Nikhil suggested. Just copy the model node to the value node of the same structure. Removing the element from the value node is also very simple task.

Also at later point of time if it is required to execute the model again it would not effect your value node values at all.

I hope this will help.

thanks & regards,

Manoj

Former Member
0 Kudos

Hi,

Hope the following link will help you.

http://help.sap.com/saphelp_nw70/helpdata/EN/95/93fe1e71a2e44691b1f041e67f71aa/frameset.htm

thanks & regards,

Manoj

Former Member
0 Kudos

Hii,

Can u please tell me how the values have been populated in dropdown? thru simpletypes or dynamically generated??...then u can delete it accordingly......

Thanks,

parama.