问题
I have a problem where the smartfield (build in xml view using WebIDE) does not show the description of the key field instead just shows the key field in both the dropdown list columns.
example : 1(1) and the expectation is 1( local tax ) .
My service is built using tcode : SEGW and using WebIDE to develop the ui and annotation for the dropdown as a fixed list.
I see a solution smartfield annotation - valuehelp dropdown , but I am unable to add the sap:text to my service in SEGW.
Problem :
Issue Screenshot
Annotation in WebIDE:
</Annotations>
<Annotations Target="Metadata.ET_FV60Header/Pmethod">
<Annotation Term="Common.Text" String="Text1"/>
<Annotation Term="Common.ValueListWithFixedValues" Bool="true"/>
<Annotation Term="Common.ValueList">
<Record>
<PropertyValue Property="CollectionPath" String="VH_PmtMethSet"/>
<PropertyValue Property="Parameters">
<Collection>
<Record Type="Common.ValueListParameterInOut">
<PropertyValue Property="LocalDataProperty" PropertyPath="Pmethod"/>
<PropertyValue Property="ValueListProperty" String="Zlsch"/>
<Annotation Term="Common.Label" String="Text1"/>
</Record>
<Record Type="Common.ValueListParameterDisplayOnly">
<PropertyValue Property="ValueListProperty" String="Text1"/>
</Record>
</Collection>
</PropertyValue>
</Record>
</Annotation>
</Annotations>
回答1:
I was able to solve the problem by adding the property "sap:text" to my entity definition in SAP using the following;
- Open the corresponding ZCL*MPC_EXT class using tcode SE80 or SE24.
- Redefine the method "DEFINE" under the above class. Additional properties can be added here in this method for services created via tcode : SEGW.
Code to be added under DEFINE method
** ET_Entity is my Value Help Entity data model name ( not entity set) ** FIELD_ID is the key property under the above entity to which we want to display the description in the dropdown list. ** FIELD_DESC is the property that contains the description.
Entity metadata :
Entity Data definition for Value Help( as Drop Down list )
回答2:
You could do the same by adding a further annotation (targeting a specific property of the "helper" entity set) directly in WebIDE as follows:
<Annotations Target="Metadata.VH_PmtMeth/Zlsch">
<Annotation Term="Common.Text" Path="Text1"/>
</Annotations>
来源:https://stackoverflow.com/questions/65146465/smartfield-annotation-valuehelp-dropdown-does-not-show-description