Show TOC

Propagating Settings to SAPUI5Locate this document in the navigation structure

The following code example shows how you can propagate user settings to an SAPUI5 application.

You would typically insert such code into your controller's onInit() method.

  var oUser = sap.ui2.srvc.getUser();

  oUser.load(
    {
      depthAtRoot: 2,
      nodeId: "FOO~Z_ACME_BAR:42",
      depthAtNode: 1
    },
    function () {
      var oFormatSettings = sap.ui.getCore().getConfiguration().getFormatSettings();

      oFormatSettings.setLegacyNumberFormat(oUser.getNumberFormat());
      oFormatSettings.setLegacyDateFormat(oUser.getDateFormat());
      oFormatSettings.setLegacyTimeFormat(oUser.getTimeFormat());
    },
    function (sError) {
      // failure handler
    }
  );
Note Make sure that you do not create any objects relying on formatting options before the configuration has the correct values. This applies to resource bundles, number formatters, date formatters and time formatters.