cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Set field Read only in Restful Application Programming when creating record

AbhishekSharma
Active Contributor
0 Kudos
11,108

Hi Gurus,

I am trying to set Additional Binding fields to be readonly in RAP while creating record...

When I run application the field still allows to change the value.

When I choose value from F4 short description gets updated but the field is still editable. How can I make it readonly...

Below is annotation :

@UI:{ lineItem: [ { position : 80 } ],
     identification : [{ position : 80 }] }
     @Consumption.valueHelpDefinition: [{ entity:
  {name: 'ZI_GENDER_5001' , element: 'Value' },
  distinctValues: true,
  additionalBinding: [{ localElement: 'Genderdesc', 
                        localParameter: '',
                        localConstant: '',
                        parameter: '',
                        element: 'Description',
                        usage: #FILTER_AND_RESULT }]
  }]
  Gender;
  @UI: { //lineItem:       [{ position: 100, importance: #HIGH, label: '' }],
    identification: [{ position: 100, label: '', importance: #HIGH }] }
  
  Genderdesc;
  @UI:{ lineItem: [ { position : 90 } ],
     identification : [{ position : 90 }] }

I have tried @ObjectModel.readonly = true

but getting error message property is not released yet.

Please help...

https://www.youtube.com/channel/UCjXZ-tts_5gde1QvptsNbrQ?sub_confirmation=1

Thanks-

Abhishek

View Entire Topic
Edrilan_Berisha
Product and Topic Expert
Product and Topic Expert

in RAP you do not use the annotation anymore on CDS view level or projection level.

You have to define this in the behavior definition.

the syntax is the following:

field ( readonly ) Genderdesc;

You should synchronize your RAP BO afterwards again and depending on if you still have a gateway service in place or not, you should also regenerate that.

Best,

Edrilan Berisha

SAP S/4HANA Financials Development

sdig89
Participant
0 Kudos
Hello Edrilan, I had recently a similar requirement to the one in this blog (to make a custom field read only in the standard Sales Order V2 Fiori tile) and it worked by extending the standard Behavior definition with the "field ( read only ) YY1_..." statement. I have a question though. What if, my custom field needs to be made read only based on a specific rule and made available based on another rule? In this case the "field ( read only ) ..." won't work anymore. Do you know how to implement such requirement ? (I would like to avoid adding a logic to check if the field is maintained or not, at the SAVE operation or at a BAdI SAVE operation). Thank you