cancel
Showing results for 
Search instead for 
Did you mean: 

OData Update Action / Mobile Dev. Kit

0 Kudos

Hello guys,

can someone explain me, how the Update Action in Sap Mobile Dev. Kit works ?

I want to use my method UpdateEntity (Backend), but i don't know how execute it with OData actions.

I specified my service and my EntitySet but there are things like OData-Readlink and Update-Link required.

Unfortunately i can't define the Update Link.

Thank you for your help.

Greetings,

Timo

Accepted Solutions (0)

Answers (3)

Answers (3)

bill_froelich
Product and Topic Expert
Product and Topic Expert

In MDK if you want to Update an existing Entity you would use an OData / UpdateEntity action type. When specifying this action you will need to set the target for the Update to the specific entity record you are updating. This is typically done through a read link that is usually available in the entity that provides the necessary pathing for the backend to know exactly which entity is being updated.

Typically when setting your target you will check the Read Link option and enter {@odata.readLink} as the value.

You would then specify the properties being updated along with their new values.

--Bill

Jitendra_Kansal
Product and Topic Expert
Product and Topic Expert

Timo Dittrich

let's say - you have customer list and it's details page. you want to update customer details, so you create a new Edit customer details page where you have fields that you want to update or want to have as it is. You may add a button/action bar item e.g."Save".

You can call that "updateEntity" odata action on pressing "Save".

Coming back to your question -

when you create this "updateEntity" action, make sure to check "Read Link" box and then "insert to Expression"

The readlink is a direct reference to an individual entity set entry.

and then under Properties - select the ones you want to update and bind to respective UI control in object browser

select "value" for corresponding control

and "current page"

click on "insert to Expression"

It would be helpful in order to find controls by providing them a meaningful name

e.g. here in edit page, for "First Name" , i have given controls name as FCEditFirstName.

and then you can have A ClosePage (Completed) action on success of that odata action.

Regarding updateLinks, i haven't tried it yet, but looks like you can define it when you need to update associated entities.

0 Kudos

Hi Jitendra,

Thanx for this helpful blog.

Could you please tell us if In edit screen one more field which I want to update in different entityset (means not in Customer entityset ) after clicking on save button
so how can we do this.


Thanx & Regards,
Shubham

0 Kudos

Thank you for your answers.

I think i found the Error.

It says it's sending a merge, but it's sending a post (which is wrong i guess).

Log(Cloud Platform):

Log (SAP):

And the request dies in the class shown on the screenshot below, before it jumps into the class of my OData Service.

Do you know, how i can fix that ?

Thank you for your help.

Greetings,

Timo

Jitendra_Kansal
Product and Topic Expert
Product and Topic Expert
0 Kudos

dittricht

Were you able to resolve your issue? If so, please post an answer so others might benefit from your findings.