cancel
Showing results for 
Search instead for 
Did you mean: 

Show Simple type enumeration description in text view

Former Member
0 Kudos

Hello,

I'm trying to show the description of a simple type enumeration instead of the key, much the same way as a dropDownByKey-element.

I have created a structure containing my simple type, and bound it to a context element. If I bind a dropdownByKey to the context element and sets the element to the key value it works and shows the Description, but I want to do the same with a textview, right now it shows the key value.

Accepted Solutions (0)

Answers (2)

Answers (2)

BeGanz
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Matthias,

please have a look at my article <b>Yet Another EVS Valuehelp - Showing Display Texts for Keys</b>

(https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/unkown/web dynpro tutorial and sample applications.faq#q-24). It exactly deals with your issue.

Regards, Bertram

Former Member
0 Kudos

Hi,

I got it working using the method above, but I'll have a look at your article to see if there's a better way to solve my issue.

Regards,

Mattias

Former Member
0 Kudos

Hi Mattias,

1. In private variables (between <b>//@@begin others .. //@@end</b>) of view controller declare:

private ISimpleValueSet _svsDescriptions;

2. In wdDoInit initialize this variable:

_svsDescriptions = wdContext
  .nodeMyData()
    .getNodeInfo()
      .getAttribute("MyKey")
        .getSimpleType()
          .getSVServices()
            .getValues();

3. In context create attribute MyKeyDescription as string, read-only, calculated. Create it for the same node as the <b>MyKey</b> attr itself, i.e. <b>MyData</b> in this example.

4. Type the following in getter for MyKeyDescription:

return _svsDescriptions.getText(element.getMyKey());

5. Bind TextView text to MyKeyDescriptor.

VS

Former Member
0 Kudos

Thank you, that's exactly what I'm looking for.

However I get the exception below when I try to create the value set. I am positive that I'm using the right attribute key.

/Mattias

com.sap.tc.webdynpro.progmodel.context.ContextConfigurationException: SimpleType could not be created from xmlMap {SimpleType={ExternalRepresentation={uppercase=false, defaultValue=, maxExternalLength=0, readOnly=false, translateFlag=false, format=}, baseTypeName1=, typeKind=SimpleType, baseTypeName=, Hint={softwareLanguage=java, languageDataType=se.ringhals.pm.structures.type}, backendName=, TextObject={locale=, quickInfo=, docuUrl=, fieldLabel=Typbeteckning, description=, columnLabel=}, prefix=se.ringhals.pm.structures, classRepresentation=true, builtInType=string, name=type}}
	at com.sap.tc.webdynpro.progmodel.context.AttributeInfo.init(AttributeInfo.java:462)
	at com.sap.tc.webdynpro.progmodel.context.NodeInfo.initAttributes(NodeInfo.java:771)
	at com.sap.tc.webdynpro.progmodel.context.NodeInfo.init(NodeInfo.java:756)
	at com.sap.tc.webdynpro.progmodel.context.NodeInfo.init(NodeInfo.java:761)
.
.
.
.
Caused by: com.sap.dictionary.runtime.DdException: SimpleType could not be created from xmlMap {SimpleType={ExternalRepresentation={uppercase=false, defaultValue=, maxExternalLength=0, readOnly=false, translateFlag=false, format=}, baseTypeName1=, typeKind=SimpleType, baseTypeName=, Hint={softwareLanguage=java, languageDataType=se.ringhals.pm.structures.Typbeteckning}, backendName=, TextObject={locale=, quickInfo=, docuUrl=, fieldLabel=Typbeteckning, description=, columnLabel=}, prefix=se.ringhals.pm.structures, classRepresentation=true, builtInType=string, name=typbeteckning}}
	at com.sap.dictionary.runtime.DdSimpleType.makeNew(DdSimpleType.java:188)
	at com.sap.dictionary.runtime.DdSimpleType.makeNew(DdSimpleType.java:210)
	at com.sap.dictionary.runtime.DdJavaProvider.getDataType(DdJavaProvider.java:62)
	at com.sap.dictionary.runtime.DdField.getDataType(DdField.java:153)
	at com.sap.tc.webdynpro.progmodel.context.AttributeInfo.init(AttributeInfo.java:460

Former Member
0 Kudos

I do not understand exactly what code cause an exception.

Could you provide code snippet itself as well as more trace info -- most importantly the very top and the very bottom of stack trace?

VS

Former Member
0 Kudos

The code that causes the exception is

[code]_svsDescriptions = wdContext.nodeNotificationStructure().getNodeInfo().getAttribute("PRIORITY").getSimpleType().getSVServices().getValues();[/code]

The stack trace doesn't really say anything more than the parts I cut&pasted. But I'll have a look in the trace file to see if there's another "caused by".

[code]An error has occurred:

"Failed to process the request."

Please contact your system administrator.

-


Hide details

Web Dynpro client:

HTML Client

Web Dynpro client capabilities:

User agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.0.3705), version: null, DOM version: null, client type: msie6, client type profile: ie6, ActiveX: enabled, Cookies: enabled, Frames: enabled, Java applets: enabled, JavaScript: enabled, Tables: enabled, VB Script: enabled

Web Dynpro runtime:

Vendor: SAP, Build ID: 6.4009.00.0000.20041104173322.0000 (release=630_REL, buildtime=2004-11-18:22:17:10[UTC], changelist=298578, host=PWDFM027)

Web Dynpro code generators of DC local/PlantMaintanence:

SapDictionaryGenerationCore: 6.4009.00.0000.20040910101802.0000 (release=630_VAL_REL, buildtime=2004-10-18:21:31:53[UTC], changelist=280522, host=PWDFM026.wdf.sap.corp)

SapMetamodelWebDynpro: 6.4009.00.0000.20040910102423.0000 (release=630_VAL_REL, buildtime=2004-10-18:21:36:19[UTC], changelist=280539, host=PWDFM026.wdf.sap.corp)

SapMetamodelCore: 6.4009.00.0000.20040730142052.0000 (release=630_VAL_REL, buildtime=2004-10-18:21:26:00[UTC], changelist=269100, host=PWDFM026.wdf.sap.corp)

SapWebDynproGenerationTemplates: 6.4009.00.0000.20041011171310.0000 (release=630_VAL_REL, buildtime=2004-10-18:21:55:01[UTC], changelist=290362, host=PWDFM026)

SapWebDynproGenerationCTemplates: 6.4009.00.0000.20041011171310.0000 (release=630_VAL_REL, buildtime=2004-10-18:21:55:01[UTC], changelist=290362, host=PWDFM026)

SapGenerationFrameworkCore: 6.4009.00.0000.20040910102127.0000 (release=630_VAL_REL, buildtime=2004-10-18:21:25:03[UTC], changelist=280527, host=PWDFM026.wdf.sap.corp)

SapIdeWebDynproCheckLayer: 6.4009.00.0000.20040910102318.0000 (release=630_VAL_REL, buildtime=2004-10-18:21:41:01[UTC], changelist=280536, host=PWDFM026.wdf.sap.corp)

SapMetamodelDictionary: 6.4009.00.0000.20040609163924.0000 (release=630_VAL_REL, buildtime=2004-10-18:21:29:01[UTC], changelist=253570, host=PWDFM026.wdf.sap.corp)

SapMetamodelCommon: 6.4009.00.0000.20040730142052.0000 (release=630_VAL_REL, buildtime=2004-10-18:21:26:11[UTC], changelist=269100, host=PWDFM026.wdf.sap.corp)

SapWebDynproGenerationCore: 6.4009.00.0000.20040910102318.0000 (release=630_VAL_REL, buildtime=2004-10-18:21:41:33[UTC], changelist=280536, host=PWDFM026.wdf.sap.corp)

SapDictionaryGenerationTemplates: (unknown)

Web Dynpro code generators of DC sap.com/tcwddispwda:

No information available

Web Dynpro code generators of DC sap.com/tcwdcorecomp:

No information available

J2EE Engine:

6.40 patchlevel 87289.311

Java VM:

Java HotSpot(TM) Server VM, version: 1.4.2_06-b03, vendor: Sun Microsystems Inc.

Operating system:

Windows 2003, version: 5.2, architecture: x86

-


Error stacktrace:

com.sap.tc.webdynpro.progmodel.context.ContextConfigurationException: SimpleType could not be created from xmlMap {SimpleType={ExternalRepresentation={uppercase=false, defaultValue=, maxExternalLength=0, readOnly=false, translateFlag=false, format=}, baseTypeName1=, typeKind=SimpleType, baseTypeName=, Hint={softwareLanguage=java, languageDataType=se.ringhals.pm.structures.Typbeteckning}, backendName=, TextObject={locale=, quickInfo=, docuUrl=, fieldLabel=Typbeteckning, description=, columnLabel=}, prefix=se.ringhals.pm.structures, classRepresentation=true, builtInType=string, name=typbeteckning}}

at com.sap.tc.webdynpro.progmodel.context.AttributeInfo.init(AttributeInfo.java:462)

at com.sap.tc.webdynpro.progmodel.context.NodeInfo.initAttributes(NodeInfo.java:771)

at com.sap.tc.webdynpro.progmodel.context.NodeInfo.init(NodeInfo.java:756)

at com.sap.tc.webdynpro.progmodel.context.NodeInfo.init(NodeInfo.java:761)

at com.sap.tc.webdynpro.progmodel.context.Context.init(Context.java:40)

at com.sap.tc.webdynpro.progmodel.controller.Controller.init(Controller.java:199)

at com.sap.tc.webdynpro.clientserver.cal.ClientComponent.init(ClientComponent.java:346)

at com.sap.tc.webdynpro.clientserver.cal.ClientApplication.init(ClientApplication.java:352)

at com.sap.tc.webdynpro.clientserver.task.WebDynproMainTask.execute(WebDynproMainTask.java:593)

at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.executeTasks(AbstractClient.java:59)

at com.sap.tc.webdynpro.clientserver.cal.ClientManager.doProcessing(ClientManager.java:249)

at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doWebDynproProcessing(DispatcherServlet.java:154)

at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doContent(DispatcherServlet.java:116)

at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doGet(DispatcherServlet.java:48)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:385)

at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:263)

at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:340)

at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:318)

at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:821)

at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:239)

at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)

at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:147)

at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:37)

at com.sap.engine.core.cluster.impl6.session.UnorderedChannel$MessageRunner.run(UnorderedChannel.java:71)

at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)

at java.security.AccessController.doPrivileged(Native Method)

at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:94)

at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:162)

Caused by: com.sap.dictionary.runtime.DdException: SimpleType could not be created from xmlMap {SimpleType={ExternalRepresentation={uppercase=false, defaultValue=, maxExternalLength=0, readOnly=false, translateFlag=false, format=}, baseTypeName1=, typeKind=SimpleType, baseTypeName=, Hint={softwareLanguage=java, languageDataType=se.ringhals.pm.structures.Typbeteckning}, backendName=, TextObject={locale=, quickInfo=, docuUrl=, fieldLabel=Typbeteckning, description=, columnLabel=}, prefix=se.ringhals.pm.structures, classRepresentation=true, builtInType=string, name=typbeteckning}}

at com.sap.dictionary.runtime.DdSimpleType.makeNew(DdSimpleType.java:188)

at com.sap.dictionary.runtime.DdSimpleType.makeNew(DdSimpleType.java:210)

at com.sap.dictionary.runtime.DdJavaProvider.getDataType(DdJavaProvider.java:62)

at com.sap.dictionary.runtime.DdField.getDataType(DdField.java:153)

at com.sap.tc.webdynpro.progmodel.context.AttributeInfo.init(AttributeInfo.java:460)

... 29 more

[/code]

Former Member
0 Kudos

Hello again, I'm sorry, the error had nothing to do with this. That explains why the stack trace did not make sense

Former Member
0 Kudos

Well, quite mysterious (or <b>mist</b>erious if you speak German

Try do the following:

1. Extract the code in question from wdDoInit into new method setup() on view controller.

2. In wdDoModifyView add the following:

if (firstTime) { wdThis.setup(); } 

Probably it (delaying initialization) helps.

VS

Former Member
0 Kudos

I do speak German

Anyway I found the problem, when I was playing around with the "Generate classes from Enumeration"-flag I had checked it on an empty enumeration and that's what threw the exception, not the simple value.

I just thought so since that was all the code I changed, sometimes all this code generation gets confusing if you're coming from "straight" Java/J2EE.