cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Getting Response From Service Layer While performing CRUD Operations

Former Member
0 Kudos
1,646

Hello Everyone,

I would like to know how can i get the response from SAP B1 HANA Service Layer during Insert, Update & Delete operation.

For e.g : If a record is successfully added into the database using the Service Layer then I should get something in the response like 1, 0, Incremented ID or new Object Key.

Same scenario for Update & Delete operation. So let me know your thoughts.

Currently, I have registered 1 UDO & performing CRUD operations through service Layer now every-time I am getting the blank response upon successful Insertion, Updation & Deletion.

So How would I confirm whether the object has been successfully added in the UDO or not.

Thanks

Rahul Jain

Accepted Solutions (1)

Accepted Solutions (1)

Trinidad
Product and Topic Expert
Product and Topic Expert

Hi Abhay,

Only the Add operation on Service Layer returns in the response body the full object you requested to be added.

Other operations like Update and Delete return an empty body response.

Nevertheless for all Service Layer operations you get a response status: "201 Created" for Add, "204 No Content" for Update, Delete,... in case of success or different error codes (3XX, 4XX,...) in case of failure. Based on the response status you can know if it was successfull or not and what is the problem. In case of success you can always send a GET request to double check the changes if required.

If you look at the Service Layer API User Manual: https://yourhanaserver:50000/ then click on "User Manual" link section "3.5 Create/Retrieve/Update/Delete (CRUD) Operations" you will be able to check the request and reponse format for each one of the entities exposed via Service Layer.

Hope it helps,
Trinidad.

Fel1
Explorer
0 Kudos

I must say this behavior makes the Service Layer implementation very inefficient.

In case of a create operation, the primary key is not returned to the sender system, which makes it necessary to maintain the external key inside of SAP or to do a GET request right after an Update and search the new created object with parameters from the external system.

Other api's like Hubspot, SugarCRM, Adobe always return at least the primary key.

I think this behavior should be changed.

Answers (0)