on 02-12-2018 1:16 PM
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
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"
}
});
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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... ?
Rgds
Jocelyn
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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
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
Hello Joseph BERTHE ,
Have you ever got the right solution for this? I have exactly similar requirements and came across this post.
Regards
Angshuman
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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));
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));
},
User | Count |
---|---|
77 | |
8 | |
7 | |
6 | |
6 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.