smartfield annotation - valuehelp dropdown - does not show description

坚强是说给别人听的谎言 提交于 2021-01-07 03:17:26

问题


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;

  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 )




回答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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!