cancel
Showing results for 
Search instead for 
Did you mean: 

Fiori Elements : How to navigate to an object page in Edit mode ?

Joseph_BERTHE
Active Contributor
0 Kudos

Hello,

All is in my title.

In my scenario, I have an Object page which describe the Sales order header and a list of Items.

When the user click on the action Create new Item (custom button) the application shows a popup to propose to the user a Wizard. At the end of the wizard, the application adds the item into the sale order, and then I do a navigation to the newly item.

But I want to navigate directly in edit mode.

How to handle it ?

Regards,

Joseph

Accepted Solutions (1)

Accepted Solutions (1)

former_member233511
Participant

Hi! Use Url parameter "preferredMode". Here is navigation example with draft:

var oCrossAppNav = sap.ushell.Container.getService("CrossApplicationNavigation");

oCrossAppNav.toExternal({
    target: {
        semanticObject: "MySemanticObj",
        action: "manage"
    },
    params: {
        MyObjectUUIDProp: "ffcb1ce2-9b04-449b-a851-012f2740ec61",
        MyObjectDraftUUIDProp: "00000000-0000-0000-0000-0000000000",
        preferredMode: "edit"
    }
});

Joseph_BERTHE
Active Contributor
0 Kudos

it is a good advice, but I would prefer an internal navigation and not an external.

Maybe jocelyn.dart knows a solution at this problem ?!

Joseph_BERTHE
Active Contributor
0 Kudos

Hello xefimx,

Your solution was the rigth one. It was difficult for me to understand what was your parameters but after debbuging and think I found the solution thanks to you.

Here is the final code :

var oCrossAppNav = sap.ushell.Container.getService("CrossApplicationNavigation");
oCrossAppNav.toExternal({
	target: {
		semanticObject: "ZSD_DT",
		action: "manage"
	},
	params: {
		Vbeln: response.Vbeln,
		preferredMode: "edit"
	}
});

Thanks a lot.

Regards,

Joseph

0 Kudos

Hello Joseph, is it possible to achieve the same navigation direct to Object Page to Intent Based annotation in a List Report with a semantic object and action? Thanks

0 Kudos

SAP officials confirmed this is non-documented feature and doesn't work since 1.71 unfortunately.

Answers (2)

Answers (2)

Jocelyn_Dart
Product and Topic Expert
Product and Topic Expert

Hi Joseph, That's the standard behaviour under the ABAP Programming Model for SAP Fiori.

Have you checked for some hints in the configuring internal navigation doco... ?

https://help.sap.com/viewer/468a97775123488ab3345a0c48cadd8f/1709%20001/en-US/2c65f07f44094012a511d6...

Rgds

Jocelyn

Joseph_BERTHE
Active Contributor

Hello Jocelyn,

You rigth in the case where I use Function import and action from my model.

In my requirement, I have an extension (in the list report) which show a dialog box with a Wizard. At the end of this wizard I send a Create request like this :

	var oModel = this.getView().getModel();
	var jModel = this.getView().getModel("ZUICreateSO").getData();
	oModel.create("/SOHeaders", {
	    Kunnr: jModel.Kunnr
	}, {
	    success: function(oEvent) {
	        // Get the new SO number and then navigate to the Object page 
	        var oNavCtrl = this.extensionAPI.getNavigationController();
	        var oBindingCtx = this.getView().getBindingContext();
	        var sPath = "/SOHeaders('32')";
	        var context = new sap.ui.model.Context(oBindingCtx, sPath);
	        oNavCtrl.navigateInternal(context);
	    }.bind(this)
	});

And as you can see, in the success method I use the standard extensionAPI to navigate to the newly created SalesOrder. During this call, I would like to have a parameter which says, navigate in Edit mode and not in ReadOnly.

Do you see what I mean ?

Regards,

Joseph

Joseph_BERTHE
Active Contributor
0 Kudos

No idear ? jocelyn.dart or others ? 🙂

Jocelyn_Dart
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Joseph,

Ok .. so when you expand a Draft row it automatically opens in edit mode,

With external navigation we would use the mode or preferredMode parameter.

With internal navigation, it's a little different.

In a draft-enabled app it's opening a Draft itself that triggers opening the Object Page edit mode.

So are you using a draft-enabled app? Or if not can you simulate that, e.g. using IsActiveEntity and HasActiveEntity properties?

Rgds

Jocelyn

Joseph_BERTHE
Active Contributor
0 Kudos

Hello Jocelyn,

We are in Non-Draft application, so I should look at your suggestion which is using IsActiveEntity but I don't know where to set this parameter ? Is an annotation ?

Regards,

Joseph

Joseph_BERTHE
Active Contributor
0 Kudos

Jocelyn,

After having investigating in Debug mode, I found out what was IsActiveEntity and HasActiveEntity but it didn't help me to answer to my question.

Thanks anyway.

Regards,

Joseph

Joseph_BERTHE
Active Contributor
0 Kudos

Hi Jocelyn,

Here is the version which working fine with the sap.suite.ui.generic.template.extensionAPI.NavigationController

manifest.json

 "crossNavigation": {
            "inbounds": {},
            "outbounds": {
                "NavigationID": {
                    "semanticObject": "ZSD_DT",
                    "action": "manage"
                }
            }
        }

Controller.js

var oNavCtrl = this.extensionAPI.getNavigationController();
oNavCtrl.navigateExternal("NavigationID", {
Vbeln: response.Vbeln,
preferredMode: "edit"
});

Regards,

Joseph

Angshuman
Participant
0 Kudos

Hello Joseph BERTHE ,

Have you ever got the right solution for this? I have exactly similar requirements and came across this post.

Regards

Angshuman

former_member736093
Discoverer
0 Kudos

Hi achakr2

Have you found a solution for this. I have exactly same requirement..

Thanks

Sonal

Angshuman
Participant

Hi sonalsap0507,

I was not able to find the exact solution, but I did it in an alternate way. Whenever the app is navigating to the object page I was triggering the "press" event of the "Edit" button in the Object Page extension controller manually. That may not be the correct way but solved my purpose.

Here is my sample code. Added the code inside onInit() function

		this.extensionAPI.attachPageDataLoaded(function (Evt) {
			var editBtn = this.getView().byId( "**** Edit button ID****");
			if (editBtn) {
				editBtn.firePress();
			}
		}.bind(this));

shivaraj1993
Explorer
0 Kudos

HI, joseph.berthe and @achakr2 I have similar scenario like external navigate to object page in edit mode, I have tried above method not working

can i get any result?

Frank1
Participant
0 Kudos

Hi Shivaraj Gowda

Did you solve it? Could you please sharing your solution?

Best regards.

Louis-Arnaud
Participant
0 Kudos

Hello,

Know that this is old, but I managed to do it that way :

- add a custom column with a custom button for action "go directly to edit mode"

- in list report controller, add this :

onGoToEdit: function (oEvent) {
var oBindingContext = oEvent.getSource().getBindingContext(); var oExtensionAPI = this.extensionAPI; var fnNavigateAfterEdit = function (oEvent) { return new Promise(function (fnResolve, fnReject) { var oNavigationController = oExtensionAPI.getNavigationController(); oNavigationController.navigateInternal(oEvent[0].response.context); fnResolve(); }); };
var fnNavigateAlreadyEdit = function (oEvent) { return new Promise(function (fnResolve, fnReject) { var oNavigationController = oExtensionAPI.getNavigationController(); oNavigationController.navigateInternal(oBindingContext); fnResolve(); }); };
this.extensionAPI.invokeActions( "<service_name>.<service_name>_Entities/<entity>Edit", //you can find the action name with network in debug mode when you press the edit button oBindingContext ).then(fnNavigateAfterEdit.bind(this), fnNavigateAlreadyEdit.bind(this));
},