Skip to Content
0

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

Feb 12 at 01:16 PM

184

avatar image

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

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
Efim Parshin Feb 13 at 06:52 AM
0

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"
    }
});

Show 2 Share
10 |10000 characters needed characters left characters exceeded

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 ?!

0

Hello Efim Parshin,

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
Jocelyn Dart
Feb 22 at 05:16 AM
0

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/2c65f07f44094012a511d6bd83f50f2d.html

Rgds

Jocelyn

Show 6 Share
10 |10000 characters needed characters left characters exceeded

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

1

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

0

No idear ? Jocelyn Dart or others ? :)

0

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

0

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

0

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

0