cancel
Showing results for 
Search instead for 
Did you mean: 

CLD200 - Error reading CityName

Miram
Discoverer
0 Kudos
240

Hi,

I started a few days ago with the CLD200 lesson. Yesterday I tried to extend the BusinessPartner entity and reading/add the CityName from a redirected entity.

I changed the SCHEMA.CDS and RISK-SERVICE.CDS to add A_BusinessPartnerAddress to the CDS.

SCHEMA.CDS

entity Risks : cuid, managed {
        title                    : String(100);
        owner                    : String;
        prio                     : Association to Priority;
        descr                    : String;
        miti                     : Association to Mitigations;
        impact                   : Integer;
        bp                       : Association to BusinessPartners;
        virtual criticality      : Integer;
        virtual PrioCriticality : Integer;
}





entity BusinessPartners as projection on external.A_BusinessPartner {
   key BusinessPartner,
   BusinessPartnerFullName as FullName,
   BusinessPartnerIsBlocked as isBlocked,
   to_BusinessPartnerAddress :redirected to SupplierAddresses,
}

entity SupplierAddresses as projection on external.A_BusinessPartnerAddress {
    key AddressID,
    CityName

  }

RISK-SERVICE.CDS
    // BusinessPartner will be used later
    @readonly entity BusinessPartners as projection on rm.BusinessPartners;
        
    // BusinessPartner will be used later
    @readonly entity SupplierAddresses as projection on rm.SupplierAddresses;

I was able to add bp/to_BusinessPartner/Address/CityName as BasicField with the Fiori PageEditor to the columns.

Bild1.png

When I start the FIORI List APP, CityName is emty and the BTP Terminal shows an error. 

 

[odata] - POST /odata/v4/service/risk/$batch 
[odata] - > READ Risks {
  '$count': 'true',
  '$filter': '(IsActiveEntity eq false or SiblingEntity/IsActiveEntity eq null)',
  '$select': 'HasActiveEntity,ID,IsActiveEntity,PrioCriticality,criticality,impact,owner,prio_code,title',
  '$expand': 'bp($select=BusinessPartner,FullName;$expand=to_BusinessPartnerAddress($select=AddressID,CityName)),miti($select=ID,IsActiveEntity,descr),prio($select=code,descr)',
  '$skip': '0',
  '$top': '30'
}
[odata] - POST /odata/v4/service/risk/$batch 
[odata] - > READ Risks(ID=20466922-7d57-4e76-b14c-e53fd97dcb13,IsActiveEntity=true)/bp {
  '$select': 'BusinessPartner',
  '$expand': 'to_BusinessPartnerAddress($select=AddressID,CityName)'
}
[odata] - > READ Risks(ID=20466922-7d57-4e76-b14c-e53fd97dcb12,IsActiveEntity=true)/bp {
  '$select': 'BusinessPartner',
  '$expand': 'to_BusinessPartnerAddress($select=AddressID,CityName)'
}
[odata] - > READ Risks(ID=20466922-7d57-4e76-b14c-e53fd97dcb11,IsActiveEntity=true)/bp {
  '$select': 'BusinessPartner',
  '$expand': 'to_BusinessPartnerAddress($select=AddressID,CityName)'
}
[remote] - Error: Error during request to remote service: 
Ressource nicht gefunden für URI-Segment
    at run (/home/user/projects/risk-management/node_modules/@sap/cds/libx/_runtime/remote/utils/client.js:310:31)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async RemoteService.<anonymous> (/home/user/projects/risk-management/node_modules/@sap/cds/libx/_runtime/remote/Service.js:295:20)
    at async next (/home/user/projects/risk-management/node_modules/@sap/cds/lib/srv/srv-dispatch.js:79:17)
    at async RemoteService.handle (/home/user/projects/risk-management/node_modules/@sap/cds/lib/srv/srv-dispatch.js:77:10)
    at async RemoteService.handle (/home/user/projects/risk-management/node_modules/@sap/cds/libx/_runtime/remote/Service.js:343:22)
    at async ApplicationService.<anonymous> (/home/user/projects/risk-management/srv/risk-service.js:56:16)
    at async next (/home/user/projects/risk-management/node_modules/@sap/cds/lib/srv/srv-dispatch.js:79:17)
    at async ApplicationService.handle (/home/user/projects/risk-management/node_modules/@sap/cds/lib/srv/srv-dispatch.js:77:10)
    at async cds.ApplicationService.handle (/home/user/projects/risk-management/node_modules/@sap/cds/libx/_runtime/fiori/lean-draft.js:193:20) {
  statusCode: 502,
  reason: [AxiosError: Error during request to remote service: 
  Ressource nicht gefunden für URI-Segment] {
    code: 'ERR_BAD_REQUEST',
    config: {
      timeout: 10000,
      xsrfCookieName: 'XSRF-TOKEN',
      xsrfHeaderName: 'X-XSRF-TOKEN',
      maxContentLength: -1,
      maxBodyLength: -1,
      proxy: false,
      method: 'get',
      baseURL: 'https://sandbox.api.sap.com/s4hanacloud/sap/opu/odata/sap/API_BUSINESS_PARTNER/',
      url: "/Risks(guid'20466922-7d57-4e76-b14c-e53fd97dcb13')/bp?$select=BusinessPartner,to_BusinessPartnerAddress%2FAddressID,to_BusinessPartnerAddress%2FCityName&$expand=to_BusinessPartnerAddress&$filter=LastName%20ne%20''%20and%20FirstName%20ne%20''",
      data: undefined
    },
    request: {
      method: 'GET',
      url: "https://sandbox.api.sap.com/s4hanacloud/sap/opu/odata/sap/API_BUSINESS_PARTNER//Risks(guid'20466922-7d57-4e76-b14c-e53fd97dcb13')/bp?$select=BusinessPartner,to_BusinessPartnerAddress%2FAddressID,to_BusinessPartnerAddress%2FCityName&$expand=to_BusinessPartnerAddress&$filter=LastName%20ne%20''%20and%20FirstName%20ne%20''",
      headers: [Object]
    },
    response: {
      status: 404,
      statusText: 'Not Found',
      headers: [Object],
      body: [Object]
    },
    correlationId: '4f4d0ae7-df5c-4123-ae36-69e9f72b030d'
  }
}
[cds] - Error: Error during request to remote service: 
Ressource nicht gefunden für URI-Segment
    at run (/home/user/projects/risk-management/node_modules/@sap/cds/libx/_runtime/remote/utils/client.js:310:31)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async RemoteService.<anonymous> (/home/user/projects/risk-management/node_modules/@sap/cds/libx/_runtime/remote/Service.js:295:20)
    at async next (/home/user/projects/risk-management/node_modules/@sap/cds/lib/srv/srv-dispatch.js:79:17)
    at async RemoteService.handle (/home/user/projects/risk-management/node_modules/@sap/cds/lib/srv/srv-dispatch.js:77:10)
    at async RemoteService.handle (/home/user/projects/risk-management/node_modules/@sap/cds/libx/_runtime/remote/Service.js:343:22)
    at async ApplicationService.<anonymous> (/home/user/projects/risk-management/srv/risk-service.js:56:16)
    at async next (/home/user/projects/risk-management/node_modules/@sap/cds/lib/srv/srv-dispatch.js:79:17)
    at async ApplicationService.handle (/home/user/projects/risk-management/node_modules/@sap/cds/lib/srv/srv-dispatch.js:77:10)
    at async cds.ApplicationService.handle (/home/user/projects/risk-management/node_modules/@sap/cds/libx/_runtime/fiori/lean-draft.js:193:20) {
  statusCode: 502,
  reason: [AxiosError: Error during request to remote service: 
  Ressource nicht gefunden für URI-Segment] {
    code: 'ERR_BAD_REQUEST',
    config: {
      timeout: 10000,
      xsrfCookieName: 'XSRF-TOKEN',
      xsrfHeaderName: 'X-XSRF-TOKEN',
      maxContentLength: -1,
      maxBodyLength: -1,
      proxy: false,
      method: 'get',
      baseURL: 'https://sandbox.api.sap.com/s4hanacloud/sap/opu/odata/sap/API_BUSINESS_PARTNER/',
      url: "/Risks(guid'20466922-7d57-4e76-b14c-e53fd97dcb13')/bp?$select=BusinessPartner,to_BusinessPartnerAddress%2FAddressID,to_BusinessPartnerAddress%2FCityName&$expand=to_BusinessPartnerAddress&$filter=LastName%20ne%20''%20and%20FirstName%20ne%20''",
      data: undefined
    },
    request: {
      method: 'GET',
      url: "https://sandbox.api.sap.com/s4hanacloud/sap/opu/odata/sap/API_BUSINESS_PARTNER//Risks(guid'20466922-7d57-4e76-b14c-e53fd97dcb13')/bp?$select=BusinessPartner,to_BusinessPartnerAddress%2FAddressID,to_BusinessPartnerAddress%2FCityName&$expand=to_BusinessPartnerAddress&$filter=LastName%20ne%20''%20and%20FirstName%20ne%20''",
      headers: [Object]
    },
    response: {
      status: 404,
      statusText: 'Not Found',
      headers: [Object],
      body: [Object]
    },
    correlationId: '4f4d0ae7-df5c-4123-ae36-69e9f72b030d'
  },
  id: '1536767',
  level: 'ERROR',
  timestamp: 1710839839399

Any ideas what's wrong? The url request look fine.

Thanks for your help.

Miriam

Accepted Solutions (0)

Answers (0)