Warm tip: This article is reproduced from serverfault.com, please click

smartfield annotation

发布于 2020-12-04 15:40:54

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>
Questioner
k4sap
Viewed
0
k4sap 2020-12-07 23:57:11

I was able to solve the problem by adding the property "sap:text" to my entity definition in SAP using the following;

  1. Open the corresponding ZCL*MPC_EXT class using tcode SE80 or SE24.
  2. 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 )