cancel
Showing results for 
Search instead for 
Did you mean: 

Using Custom Enumerations in WebDynpro

Former Member
0 Kudos
96

Good morning,

i need a little hint for the following situation:

i created a entity service using a custom enumeration as an attribute. running this entity service in the CAF- Testtool the entries of the custom enumeration are displayed as expected, but...

i would like to use this custom enumeration inside a webdynpro without using the standard CAF webdynpro patterns, like object browser, object link etc...

when i create a DropDownbyKey and bind the datasource on a context node which has the type of my custom enumeration the following error occured.

How can i bind or access my custom enumeration inside the webdynpro runtime?

I am very grateful (awarding points ) for any help.

Thanks Jens

The initial exception that caused the request to fail, was:

   com.sap.dictionary.runtime.DdException: SimpleType can't be created from xmlMap {SimpleType={ExternalRepresentation={uppercase=false, defaultValue=, maxExternalLength=0, readOnly=false, translateFlag=false, format=}, baseTypeName1=, typeKind=SimpleType, baseTypeName=, Hint={softwareLanguage=java, languageDataType=com.siemens.poc.customtypes.Group}, backendName=, TextObject={locale=, quickInfo=Group, docuUrl=, fieldLabel=Group, description=, columnLabel=Group}, prefix=com.siemens.poc.customtypes, classRepresentation=true, SchemaType={totalDigits=0, minExclusive=, maxLength=100, maxExclusive=, minLength=0, length=0, fractionDigits=0, maxInclusive=, minInclusive=}, builtInType=string, name=Group}}

    at com.sap.dictionary.runtime.DdSimpleType.makeNew(DdSimpleType.java:188)
    at com.sap.dictionary.runtime.DdSimpleType.makeNew(DdSimpleType.java:211)
    at com.sap.dictionary.runtime.DdJavaProvider.getDataType(DdJavaProvider.java:62)
    at com.sap.dictionary.runtime.DdJavaProvider.getDataType(DdJavaProvider.java:45)
    at com.sap.dictionary.runtime.DdDictionary.getDataType(DdDictionary.java:95)
    ... 41 more

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

The first step is to uncheck the check box named "Generate a class representation of the enumeration", it turns out that dictionary runtime throws an exception (the one that you encounter) when this is check but no enumerations are entered in this screen - you are going to enter the enumeration value through the CAF's tool. The next step is to enter source code like the one shown below in the view controler (the exact place to enter the code depends on the use case):

TypedFieldDescriptorFactory factory = new TypedFieldDescriptorFactory();                                            
TypedFieldDescriptor descriptor = factory.getTypedFieldDescriptor("", "String", "com.sap.Cities", null, Locale.GERMAN);                                            
ISimpleType type = descriptor.getSimpleType();                                                                                
ISimpleTypeModifiable modifiable = wdThis.wdGetAPI().getContext().getModifiableTypeOf("Cities.Cities");
modifiable.setSVServices(type.getSVServices()); 

and the Locale variable is the Locale you'd like to use, most probable it would be the user's locale. One last thing is that you reference to the DC caf/runtime/impl to build

the source code mentioned above, the public part is named "CAFRuntimeAPI". To define a reference for the runtime you need to modify the "Web Dynpro References" of the appropriate WebDynpro application by adding a "Shared Reference" to "sap.com/cafruntimeear".

Former Member
0 Kudos

Thanks Daniel,

when my mind is with me, than you helped me in this topic via OSS. Because points are only given here, here we go..

Greetings, Jens

Answers (1)

Answers (1)

former_member4529
Active Contributor
0 Kudos

Hi,

The custom data type (enumeration) you've created in CAF should be exposed as public part in the Dictionary project. Select the data type and right-click and select Add To Public part. Then re-build the CAF project and CAF Web Dynpro model and refresh the model in WDP project.

Thanks,

Dipankar

Former Member
0 Kudos

Hi Dipankar,

thanks for your reply, but this i have done,yet.

As i described in my first post - i have seen my custom enumeration in the CAF testtool - that means my enumeration is visible.

Please notice, that i use CAF custom enumeration and set the values for this enumeration at runtime in the CAF administration tool section.

Any other hints?