cancel
Showing results for 
Search instead for 
Did you mean: 

Consider Launchpad User Defaults in a RAP based Fiori Elements Application

07-13-2022 6:21 PM
amadeusgrabmayer Participant
1393 views 2 comments
0 Likes
SAP Managed Tags
Subscribe

Hi,

in the Launchpad there is the option to set default values:

Here for example I set the "Sales Organization (Verkaufsorg.)" to "1600":

According to the blog Applying User Defaults in SAP S/4HANA I hoped this would work out of the boxed in a generated RAP (ABAP RESTful Application Programming Model) based Fiori Elements application.

And in the Fiori Elements List Report it indeed does work out of the box:

But when you "Create" a new object (from the List Action), the field stays empty

Does somebody know if there is an annotation or something which can be set to also get the Default Value set in the Object Page?

Thanks
Amadeus

0 Likes

Accepted Solutions (0)

Answers (1)

Answers (1)

Senqi_Hu
Participant
0 Likes

Hi amadeusgrabmayer.

You can extension your fiori element project in font-end.

sap.ui.controller("yourProjectNameSpace.ext.controller.ObjectPageExt", {

	onInit: function() {
		var oNavController = this.getOwnerComponent().getAppComponent().getNavigationController();
		this.extensionAPI.attachPageDataLoaded(this._setCreateDefaultValue.bind(this, oNavController));
	},

	_setCreateDefaultValue: function() {
		var bCreateMode = this.getOwnerComponent().getModel("ui").getProperty("/createMode");
		if (bCreateMode) {
			var sPath = this.getView().getBindingContext().getPath();
			var oInfoModel = this.getView().getBindingContext().getModel();
			oInfoModel.setProperty(sPath + "/SalesOrganization", "1600"); //replace field 'SalesOrganization' 
		}
	}
});
former_member73102
Discoverer
0 Likes

Is sending the nav controller object necessary? I don't see it used in the bound call to `_setCreateDefaultValue`