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

Is Editing Key fields not controlled in ABAP RESTful Programming ?

former_member207873
Participant
0 Kudos
3,154

Hello Experts,

Is editing the key field values of a table are not controlled in ABAP restful programming ?

I have a managed application and in my table there are three key fields . So when the user clicks on the line to edit in the report, in my mind the key fields should be disabled to edit. (Same like in SAP ECC). But the issue is, it is not doing so automatically and no validation code is working on the key fields. When i try to control editing using the below statement in the behaviour definition .

Update

field (read only) Field1 ;

it is coming as non-Editable. But then when i try to create a new record still these fields are non editable. Is this a bug or is it something we have to handle using unmanaged behaviour.

Hope i made myself clear.

Accepted Solutions (1)

Accepted Solutions (1)

former_member207873
Participant
field (mandatory:create| readonly:update); 

Adding readonly:update will make the entity read only for the key fields during update .

Answers (2)

Answers (2)

vishnucta
Active Participant
0 Kudos

For some reason above link wasnt working. so updated link.

https://help.sap.com/viewer/923180ddb98240829d935862025004d6/Cloud/en-US/7c016634024b45e0a5d288fb56c...

Eg:



  "Feature control Implementation for Action
  METHOD get_features.
    "%control-<fieldname> specifies which fields are read from the entities


    READ ENTITY zXXXX FROM VALUE #( FOR keyval IN keys
                                                      (  %key                    = keyval-%key
                                                         %control-status = if_abap_behv=>mk-on
                                                        ) )
                                RESULT DATA(lt_XXXX).


    "Return that controls the feature %features-%action-<action name>
    result = VALUE #( FOR ls_XXXX IN lt_XXXX
                       ( %key                           = ls_asset-%key
                       %field-my_id               = if_abap_behv=>fc-f-read_only
                        
                      ) ).
  ENDMETHOD.
ankahit
Participant
0 Kudos
Hello Vishnucta, I have a doubt, what is I have more than 200 fields and data are stored in table for editable. I cannot add 250 fields in feature : instance right? what can I do it to make things work?
maheshpalavalli
Active Contributor
0 Kudos

You can use dynamic field control as shown below.

Then in create you will see at as editable and in update, it will be readonly.

https://help.sap.com/viewer/923180ddb98240829d935862025004d6/Cloud/en-US/9bdfe362731b4c02ba08f9f4bc5...

-Mahesh