cancel
Showing results for 
Search instead for 
Did you mean: 

Simple Value Selector

Former Member
0 Kudos

Hi,

I have a field that uses Simple Value Selector. When I check the SVS drop down, It has 2 names Tom and Mark.

If I do not want to put any of these 2 names in that Input field, but instead put Mike in the field, it throws me the following error.

<b>String "MIKE " does not match the enumeration</b>

Is it possible in an input field associated to SVS, if I do not see a value in the SVS that I want to use. Can I input a new Value in the Input field without getting the above error.

Any help would be appreciated.

Thank you.

NAC

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Well, SVS / EVS functionality assumes validation of entered values against enumeration of all valid entries (valueset).

So if you are adding your own value from code, you have to modify original value set first (add new entry). If you let user to enter you values... Hmmm... probably you may try calculated attributes for this task and add user defined value to valueset in attribute "setter"

VS

Former Member
0 Kudos

Hi SAP Partner,

I donot know whether this would be recommended but this works..

When you define your enumeration, there is a check box "Generate a class representation of the enumeration", select this check box. This generates a java class file in the gen_ddic folder with the name as your simple type.

For your requirement to work...Open this java file and make the change as given below....

in the static method valueOf(String name), there is a line returning the object which will be like -

<i>return (<Simpletypename>) enum.get(name);</i>

change this to

<b><i>return ((<Simpletypename>) enum.get(name)!=null?(<Simpletypename>) enum.get(name):new <Simpletypename>(name));</i></b>

The problem is it may not be recommended as i have told earlier, also when you add a new value to the enumeration, this class file is generated again. So you will have to make this change again.

Also there might be problems if this project is synced with NWDI and a central build is done with the CBS, the file might be generated again which will lead to inconsistencies.

Thanks & Regards,

Renjith