Search code examples
sap-cloud-sdk

s4sdk openSAP develop extension Course - Address not created - no put operation in mock server log


I have created mock server and it shows GET operation selecting all partners and will get a partner by id.

If I click on the Add address button there is no put or post operation in the log file.

Mock server log:

Request: GET /sap/opu/odata/sap/API_BUSINESS_PARTNER/A_BusinessPartner(BusinessPartner='1003764')?$select=BusinessPartner,CreationDate,FirstName,IsFemale,IsMale,LastName,to_BusinessPartnerAddress/AddressID,to_BusinessPartnerAddress/BusinessPartner,to_BusinessPartnerAddress/CityName,to_BusinessPartnerAddress/Country,to_BusinessPartnerAddress/HouseNumber,to_BusinessPartnerAddress/PostalCode,to_BusinessPartnerAddress/StreetName&$expand=to_BusinessPartnerAddress&$format=json Reading business partner 1003764

Log from application

12:51:35.357 [http-bio-8080-exec-10] ERROR com.sap.cloud.sdk.odatav2.connectivity.ODataQuery - Successfully connected to destination service.

Am I missing a setting?


Solution

  • You can implement an add functionality for a Business Partner Address in the following way:

     BusinessPartnerAddress addressToCreate = BusinessPartnerAddress.builder()
                .businessPartner(businessPartnerId)
                .streetName("someStreet")
                .build();
    
     new DefaultBusinessPartnerService()
                .createBusinessPartnerAddress(addressToCreate)
                .execute();