2024 Aug 13 4:10 PM - edited 2024 Aug 14 2:38 PM
We have a simple requirement for Create Preliminary Billing Documents F2876 to default the Billing Date to today, and make it read-only so the user cannot change it.
This field is not a database field there is no CDS view to extend. It's a local input field bound to a local JSON model that will be sent to the backend Create method.
I created an Adaptation project and added a controller extension. I was hoping to set the value of this field in the JSON model to today's date in the onInit( ) method, and make the field read-only .
onInit: function() {
var oView = this.getView();
ExtensionAPI.getExtensionAPIPromise( oView ).then(function (oExtensionAPI) {
var settings = oView.getModel("settings").getData();
oView.getModel("settings").setProperty("/requestedBillingDocumentDate", new Date());
}.bind(this))
},
However, when my onInit method gets triggered the view has no model, nothing has been loaded and I can't get a hold of anything.
I tried to hook into the ExtensionAPI, but the extentionAPI doesn't seem to exist at that point.
Can someone please give me some hints on what the proper way is to use Extension APi to get a handle on the view model and events?
The example extension codes provided are all about simple scenario of adding a new button, none of them talk about manipulating view models or events.
Thanks
It appears that this is not possible. By making this input field bound to a local JSON model, the SAP developers have made it impossible to override the field value or set its properties (read-only).
This is a little hard for our client to accept; with all the promise of extensibility: Adaptation Projects, controller extensions, component configuration, key-user UI Adaptations, Personalizations, none of these layers provide a simple option to set a value of an input field. And it's such an important field, Billing Document Date has so many down-stream consequences in FI/CO.
Our client simply won't accept that there is no work around for this issue.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
have you tried this approach - adding a change file with similar contents:
Hi @hristotsolev ,
That is a really good suggestion, I'll give it a try.
But how would you set the value of the date field to today's date in the change file?
Thanks
User | Count |
---|---|
67 | |
8 | |
8 | |
6 | |
6 | |
6 | |
6 | |
6 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.