2

我有一个SmartField,我想连接到 ODATA 服务以valueHelp免费获得。
指向 ODATA 服务的模型如下所示:

"EAMMALFUNCTION": {
    "uri": "/sap/opu/odata/sap/EAM_MALFUNCTION_MANAGE/",
    "type": "sap.ui.model.odata.v2.ODataModel",
    "settings": {
        "defaultOperationMode": "Server",
        "defaultBindingMode": "OneWay",
        "defaultCountMode": "Request"
    },
    "dataSource": "EAM_MALFUNCTION_MANAGE",
    "preload": true
}

实体集的 uri 是/sap/opu/odata/sap/EAM_MALFUNCTION_MANAGE/I_PMContactCardEmployee,元定义是:

<EntitySet Name="I_PMContactCardEmployee" EntityType="EAM_MALFUNCTION_MANAGE.I_PMContactCardEmployeeType" sap:creatable="false" sap:updatable="false" sap:deletable="false" sap:searchable="true" sap:content-version="1"/>

<EntityType Name="I_PMContactCardEmployeeType" sap:label="Mitarbeiter" sap:content-version="1">
    <Key>
        <PropertyRef Name="PersonnelNumber"/>
    </Key>
    <Property Name="PersonnelNumber" Type="Edm.String" Nullable="false" MaxLength="8" sap:display-format="NonNegative" sap:text="EmployeeFullName" sap:label="Personalnummer"/>
    <Property Name="EmployeeFullName" Type="Edm.String" MaxLength="80" sap:label="Vollständiger Name" sap:filterable="false"/>
    <Property Name="FirstName" Type="Edm.String" MaxLength="40" sap:label="Vorname" sap:quickinfo="Vorname des Geschäftspartners (Person)"/>
    <Property Name="FamilyName" Type="Edm.String" MaxLength="40" sap:label="Nachname" sap:quickinfo="Nachname des Geschäftspartners (Person)"/>
    <Property Name="Job" Type="Edm.String" MaxLength="8" sap:display-format="NonNegative" sap:label="Stellenschlüssel" sap:quickinfo="Stelle" sap:filterable="false"/>
    <Property Name="JobName" Type="Edm.String" MaxLength="25" sap:label="Stellenbezeichnung" sap:filterable="false"/>
    <Property Name="CompanyCode" Type="Edm.String" MaxLength="4" sap:display-format="UpperCase" sap:text="CompanyCodeName" sap:label="Buchungskreis"/>
    <Property Name="CompanyCodeName" Type="Edm.String" MaxLength="25" sap:label="Name der Firma" sap:quickinfo="Buchungskreis- oder Firmen-Bezeichnung" sap:filterable="false"/>
    <Property Name="OrganizationalUnit" Type="Edm.String" MaxLength="8" sap:display-format="NonNegative" sap:label="Organisationseinheit"/>
    <Property Name="OrganizationalUnitName" Type="Edm.String" MaxLength="25" sap:label="OrgEinheitenkurztext" sap:quickinfo="Organisationseinheitenkurztext" sap:filterable="false"/>
    <Property Name="PhoneNumber" Type="Edm.String" MaxLength="30" sap:display-format="UpperCase" sap:label="Telefon" sap:quickinfo="Telefonnummer: Vorwahl+Anschluß" sap:filterable="false"/>
    <Property Name="NormalizedPhoneNumber" Type="Edm.String" MaxLength="30" sap:display-format="UpperCase" sap:label="Telefonnummer" sap:quickinfo="Vollständige Nummer: Vorwahl+Anschluß+Durchwahl" sap:filterable="false"/>
    <Property Name="MobilePhoneNumber" Type="Edm.String" MaxLength="30" sap:display-format="UpperCase" sap:label="Telefon" sap:quickinfo="Telefonnummer: Vorwahl+Anschluß" sap:filterable="false"/>
    <Property Name="MblNormalizedPhoneNumber" Type="Edm.String" MaxLength="30" sap:display-format="UpperCase" sap:label="Telefonnummer" sap:quickinfo="Vollständige Nummer: Vorwahl+Anschluß+Durchwahl" sap:filterable="false"/>
    <Property Name="DefaultEmailAddress" Type="Edm.String" MaxLength="241" sap:label="E-Mail-Adresse"/>
    <Property Name="UserID" Type="Edm.String" MaxLength="12" sap:display-format="UpperCase" sap:label="Benutzer-ID" sap:filterable="false"/>
</EntityType>

提供以下数据:

{
    "d": {
        "results": [
            {
                "__metadata": {
                    "id": "https://example:4000/sap/opu/odata/sap/EAM_MALFUNCTION_MANAGE/I_PMContactCardEmployee('00000019')",
                    "uri": "https://example:4000/sap/opu/odata/sap/EAM_MALFUNCTION_MANAGE/I_PMContactCardEmployee('00000019')",
                    "type": "EAM_MALFUNCTION_MANAGE.I_PMContactCardEmployeeType"
                },
                "PersonnelNumber": "00000019",
                "EmployeeFullName": "Test Normi_20180206",
                "FirstName": "Normi_20180206",
                "FamilyName": "Test",
                "Job": "00000000",
                "JobName": "",
                "CompanyCode": "CH01",
                "CompanyCodeName": "Country Template CH",
                "OrganizationalUnit": "50000066",
                "OrganizationalUnitName": "",
                "PhoneNumber": "",
                "NormalizedPhoneNumber": "",
                "MobilePhoneNumber": "",
                "MblNormalizedPhoneNumber": "",
                "DefaultEmailAddress": "",
                "UserID": ""
            },
            {
                "__metadata": {
                    "id": "https://example:4000/sap/opu/odata/sap/EAM_MALFUNCTION_MANAGE/I_PMContactCardEmployee('00000014')",
                    "uri": "https://example:4000/sap/opu/odata/sap/EAM_MALFUNCTION_MANAGE/I_PMContactCardEmployee('00000014')",
                    "type": "EAM_MALFUNCTION_MANAGE.I_PMContactCardEmployeeType"
                },
                "PersonnelNumber": "00000014",
                "EmployeeFullName": "TEST Einchäuferli",
                "FirstName": "Einchäuferli",
                "FamilyName": "TEST",
                "Job": "00000000",
                "JobName": "",
                "CompanyCode": "CH01",
                "CompanyCodeName": "Country Template CH",
                "OrganizationalUnit": "50000055",
                "OrganizationalUnitName": "",
                "PhoneNumber": "",
                "NormalizedPhoneNumber": "",
                "MobilePhoneNumber": "",
                "MblNormalizedPhoneNumber": "",
                "DefaultEmailAddress": "",
                "UserID": "M4711"
            }, 

我想要存档的是,连接SmartFieldODATA 服务并valueHelp免费获得,无需任何特定编码以获得价值帮助。

当我在值帮助上选择一个值时,它应该将PersonnelNumber插入到SmartField.

I_PMContactCardEmployee是一个 CDS 消费视图,它提供了一个搜索帮助的界面:

@AbapCatalog.sqlViewName: 'IPMCONTCARDEMP'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #CHECK
@VDM.viewType: #COMPOSITE
@EndUserText.label: 'Employee'
@ObjectModel.representativeKey : 'PersonnelNumber'

@Search.searchable: true

@ClientHandling.algorithm: #SESSION_VARIABLE
@ObjectModel.usageType.dataClass: #MASTER
@ObjectModel.usageType.serviceQuality: #D
@ObjectModel.usageType.sizeCategory: #L

@AccessControl.personalData.blocking: #REQUIRED

define view I_PMContactCardEmployee   

我已经尝试将 SmartField 与I_PMContactCardEmployee服务连接,如下所示:

<smartField:SmartLabel labelFor="pmAssignTo" />
<smartfield:SmartField id="pmAssignTo" binding="{EAMMALFUNCTION>/I_PMContactCardEmployee}" value="{PersonnelNumber}">
    <layoutData>
        <layout:GridData span="L7 M7 S12"/>
    </layoutData>
</smartfield:SmartField> 

我收到了错误消息:

Uncaught (in promise) Error: Cannot add direct child without default aggregation defined for control sap.ui.comp.smartfield.SmartField
4

0 回答 0