cancel
Showing results for 
Search instead for 
Did you mean: 

Problem mit Mapping OData Response von Remote Service zu Cloud Service

0 Kudos

Hallo Community,

Ich habe einen Problem mit einen Request. Den Client sendet einen Odata Request, ich leite den Request weiter an SAP Backend und handle die Response in der Cloud. Dann gebe ich den Result an den Client weiter. Das Problem liegt an den expand Schlüsselt. Wenn der expand vorkommt bekomme ich die Daten aus der Entity in Reference aber nicht die Daten von der Komplexen Datentype der Root Entity.

Ein Beispiel mit expand:

Request: $filter: contains(SPartner/Name1,'Müller') and SPartner/IsActivePartner eq 'X' and SObject/IsRentalObject eq 'X' and SObject/IsBuilding eq 'X' and SObject/IsBusinessEntity eq 'X' and SObject/IsProperty eq 'X' $expand: TAdditionalPartnerSet

Response:

"results": [{"PartnerId": "5","RoleTypeId": "TR0600","ObjectId": "IM00100000004","ContractId": "IS00100000004","DueDate": null,"NoActivities": "","IsVacant": "","Occupacy": "","SearchId": "","ModuleId": "AL","TAdditionalPartnerSet": {"results": [{"PartnerId": "1","RoleTypeId": "TR0601","SCommunication_Phone": null,"SCommunication_Mobile": null,"SCommunication_Email": null,"SCommunication_IsActiveTenantInApp": null,"SCommunication_IsMailTrackingActive": null,"Fullname": "Lukas Schmidt","SubroleTypeId": "","PartnerType": "1","RoleTypeName": "Mieter (nichtdebitorisch)","Name1": "Schmidt","SubroleTypeName": "","Name2": "Lukas","Name3": "","Name4": "","__metadata": {"type": "BusinessCockpitBackendOD2BCService.TAdditionalPartnerSet","uri": "http://localhost:4004/v2/api/businesscockpit/od2bc_srv/TAdditionalPartnerSet(PartnerId='1',RoleTypeId='TR0601')"}}]},"SFunctionalLocation": {"__deferred": {"uri": "http://localhost:4004/v2/api/businesscockpit/od2bc_srv/PartnerlistSet(PartnerId='5',RoleTypeId='TR0600',ObjectId='IM00100000004',ContractId='IS00100000004')/SFunctionalLocation"}},"SPartner": {"__deferred": {"uri": "http://localhost:4004/v2/api/businesscockpit/od2bc_srv/PartnerlistSet(PartnerId='5',RoleTypeId='TR0600',ObjectId='IM00100000004',ContractId='IS00100000004')/SPartner"}},},

Ein Beispiel ohne expand:

Request: $filter: contains(SPartner/Name1,'Müller') and SPartner/IsActivePartner eq 'X' and SObject/IsRentalObject eq 'X' and SObject/IsBuilding eq 'X' and SObject/IsBusinessEntity eq 'X' and SObject/IsProperty eq 'X'

Response:

"results": [{"PartnerId": "5","RoleTypeId": "TR0600","ObjectId": "IM00100000004","ContractId": "IS00100000004","DueDate": null,"NoActivities": "","IsVacant": "","Occupacy": "","SearchId": "","ModuleId": "AL","SFunctionalLocation": {"FunctionalLocationTypeName": "","FunctionalLocationId": "0001-0001-000-GE0001-0005","FunctionalLocationName": "","FunctionalLocationType": "","FunctionalLocationCategory": "","SupFunctionalLocationId": "","SAddress_Street": null,"SAddress_HouseNumber1": null,"SAddress_HouseNumber2": null,"SAddress_ZipCode": null,"SAddress_City": null,"SAddress_Country": null,"SAddress_Region": null,"__metadata": {"type": "BusinessCockpitBackendOD2BCService.SFunctionalLocation","uri": "http://localhost:4004/v2/api/businesscockpit/od2bc_srv/SFunctionalLocation()"}},"SPartner": {"PartnerId": "5","PartnerType": "1","Name1": "Müller","Name2": "Marion","Name3": "","Name4": "","Fullname": "Marion Müller","DateOfBirth": null,"IsActivePartner": "X","IsInactivePartner": "","IsEmptyFlat": "","Street": null,"HouseNumber1": null,"HouseNumber2": null,"ZipCode": null,"City": null,"Country": null,"Region": null,"Phone": "+493023456782","Mobile": "","Email": "i.schoenig@datatrain.de","IsActiveTenantInApp": true,"IsMailTrackingActive": false,"__metadata": {"type": "BusinessCockpitBackendOD2BCService.SPartner","uri": "http://localhost:4004/v2/api/businesscockpit/od2bc_srv/SPartner()"}},"SRole": {"RoleTypeId": "TR0600","SubroleTypeId": "","RoleTypeName": "Debitorischer Hauptmieter","SubroleTypeName": "","__metadata": {"type": "BusinessCockpitBackendOD2BCService.SRole","uri": "http://localhost:4004/v2/api/businesscockpit/od2bc_srv/SRole()"}},"SObject": {"ObjectId": "IM00100000004","FunctionalLocationId": "0001-0001-000-GE0001-0005","UsageTypeId": "0001","ObjectType": "ME","UsageTypeName": "Wohnung freifinanziert","ObjectTypeName": "Mieteinheit","ObjectName": "Saarbrücker Str. 36 1.OG rechts","CompanyCode": "0001","BusinessEntity": "1","RentalObject": "5","Building": "1","Property": "","IsBusinessEntity": "","IsRentalObject": "X","IsBuilding": "","IsProperty": "","SAddress_Street": null,"SAddress_HouseNumber1": null,"SAddress_HouseNumber2": null,"SAddress_ZipCode": null,"SAddress_City": null,"SAddress_Country": null,"SAddress_Region": null,"SPosition": {"__deferred": {"uri": "http://localhost:4004/v2/api/businesscockpit/od2bc_srv/SObject()/SPosition"}},"__metadata": {"type": "BusinessCockpitBackendOD2BCService.SObject","uri": "http://localhost:4004/v2/api/businesscockpit/od2bc_srv/SObject()"}},"SContract": {"ContractId": "IS00100000004","ContractTypeName": "Vermietung Wohnung","CompanyCode": "0001","ContractNumber": "5","ContractType": "CO02","ContractStartDate": "/Date(1167609600000+0000)/","ContractEndDate": "/Date(253402214400000+0000)/","__metadata": {"type": "BusinessCockpitBackendOD2BCService.SContract","uri": "http://localhost:4004/v2/api/businesscockpit/od2bc_srv/SContract()"}},"TAdditionalPartnerSet": {"results": [{"PartnerId": "1","RoleTypeId": "TR0601","SCommunication_Phone": null,"SCommunication_Mobile": null,"SCommunication_Email": null,"SCommunication_IsActiveTenantInApp": null,"SCommunication_IsMailTrackingActive": null,"Fullname": "Lukas Schmidt","SubroleTypeId": "","PartnerType": "1","RoleTypeName": "Mieter (nichtdebitorisch)","Name1": "Schmidt","SubroleTypeName": "","Name2": "Lukas","Name3": "","Name4": "","__metadata": {"type": "BusinessCockpitBackendOD2BCService.TAdditionalPartnerSet","uri": "http://localhost:4004/v2/api/businesscockpit/od2bc_srv/TAdditionalPartnerSet(PartnerId='1',RoleTypeId='TR0601')"}}]},

Ich brauche den Result wie oben ohne expand..aber den expand muss in den request beibleiben.

Hier ist wie ich die Daten aus den SAP Backend hole:

Select<?> select = Select.from(Od2bcSrv_.PARTNERLIST_SET)<br>                .columns(p -> p._all(), p -> p.TAdditionalPartnerSet().expand())<br>                .where(context.getCqn().where().get());

Ich kann SPartner nicht expanded, weil SPartner in SAP Backend einen komplexe Datentyp ist und nicht eine Entity.

Ich freue mich auf eure Hilfe.

LG

Ruben

Accepted Solutions (0)

Answers (0)