cancel
Showing results for 
Search instead for 
Did you mean: 

Service Layer: How To Delete a Contact Employee

d_curioni9
Explorer
590

I have an IIS application under Windows Server that needs to keep an external MS SQL Server db in sync with Hana. I have to use the Service Layer interface, because the DI API dll has memory leaks and crashes regularly.

There is no direct ContactEmplyees entity in SL. I found a way to keep the contact persons synched via PATCHes on the BusinessPartners entity. Patches with an existing InternalCode update the contact information, while patches without InternalCode insert new contact persons under the provided CardCode.

I didn't find a way of deleting them. If I use DELETE, this will remove the whole Business Partner. Any ideas? A solution I though of is using the ADO OleDb provider, but AFAIK this is discuraged for manipulating data.

d_curioni9
Explorer
0 Kudos

I have a first answer to my own question. Not ideal at all: the solution I found is GETting the whole BP information, then removing the deleted contact person from the ContactEmployees array, and finally PUTting the resulting json. This will delete the contact person (not sure Hana handles automatically the "ContactPerson" field of the BP, where the default contact person is stored, so I will check on my side if the person deleted is the default person and set the BP information accordingly).

This is far from being ideal, because the process is not transactional, and because PUTs scare me a lot, since I am not sure of what happens with information possibly not included in the json I get with the initial GET. If anyone has better ideas, please let me know.

Thanks.

Accepted Solutions (0)

Answers (0)