Fiori : navigate to Object Page in Edit Mode

There is a nice feature available on fiori elements List Report / Object page applications: navigate from list report to object page in edit mode .

This is cool, but not available in previous SAPUI5 versions (I don’t know when it appeared but it is not available in 1.71). As I couldn’t find any solution to implement this feature, I decided to code it myself and I share it with you in this blog post.

Step 1 : find the path for edit action.

This is quite simple if you are familiar with SAPUI5 application, you can find it in the annotations of the service :

Step 2 : add a custom column with an edit button.

There is a wizard to add a custom column. Just change the content of the column in the xml view fragment in order to add the button :

Step 3 : implement the javascript function in the controller extension.

Replace the action with the action you got from step 1.

Basically, this code just call the edit function on the object. If it succed, then the navigation is done to the draft object. If it failed (probably because the object is already in edit mode), then it simply navigate to the object in its current state.

The result look almost the same as the standard implementation: