0

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?

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
  • How did you implement the add operation? Would you mind sharing the code with us so that we can have a look? – Benjamin Nov 22 '18 at 13:34
  • Here is the class:public CreateAddressCommand(final BusinessPartnerService service, final BusinessPartnerAddress addressToCreate) { super(HystrixUtil.getDefaultErpCommandSetter( CreateAddressCommand.class, HystrixUtil.getDefaultErpCommandProperties().withExecutionTimeoutInMilliseconds(10000) )); this.service = service; this.addressToCreate = addressToCreate; } – Chris Hunter-Johnson Nov 23 '18 at 14:31
  • @Override public BusinessPartnerAddress run() throws Exception { return service.createBusinessPartnerAddress(addressToCreate).execute(); } – Chris Hunter-Johnson Nov 23 '18 at 14:33
  • This is now working. How do I show this as resolved? – Chris Hunter-Johnson Nov 23 '18 at 14:35
  • 1
    Just provide the resolution as answer yourself and mark it as answered so that it is documented for others having the same issue. – Philipp Herzig Nov 24 '18 at 13:26

1 Answers1

0

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();
Philipp Herzig
  • 350
  • 6
  • 10