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

How do we identify Create/Update/Delete actions in RAP application?

Ram_peddireddi
Explorer
0 Kudos
1,038

Hi Team,

I have a requirement to enable/disable input fields for input based on Create/Update/Delete action and other conditions in RAP application. How do we identify the current action that we are performing (Create/Delete/Update) in the method "get_instance_features". In core ABAP we do have a field TRTYP = H/V for this purpose. How do we do it in RAP model?

Regards,

Ram Peddireddi.

Accepted Solutions (0)

Answers (3)

Answers (3)

AbhishekSharma
Active Contributor
0 Kudos

Hi @Ram_peddireddi You may want to try Global / Instance Authorisation that has the Actions user bring to perform.

For more details you may refer below Blog post...

https://community.sap.com/t5/technology-blogs-by-members/abap-rap-global-authorization/ba-p/13558291 

https://community.sap.com/t5/technology-blogs-by-members/abap-rap-instance-authorization/ba-p/135708... 

*   Check if EDIT operation is triggered or not 
    IF requested_authorizations-%update = if_abap_behv=>mk-on OR
        requested_authorizations-%action-Edit   = if_abap_behv=>mk-on.
*--> Your code goes here
    ENDIF.

 

Hope this helps...

Thanks- 

Ram_peddireddi
Explorer
0 Kudos
Hi Abhishek, How do we identify whether the operation is CREATE or EDIT here?
MioYasutake
SAP Champion
SAP Champion
0 Kudos

@Pradeep_Reddy1 

I would select from the base CDS view to check whether the record already exists in the DB. If it does, you can say that current action is an update.

Pradeep_Reddy1
Participant
0 Kudos

You can try like below 

 

field ( readonly : update ) fieldname;

Ram_peddireddi
Explorer
0 Kudos

Hi Pradeep,

I cannot use features: instance in this case.