cancel
Showing results for 
Search instead for 
Did you mean: 

How to create CRUD using SAP RAP?

walkerist
Participant
0 Kudos
138

Hello everyone, I have created an ODATA service(Service definition, Behavior Definition) to perform CRUD operations on a custom table. 

Using SAP Gateway Client, I was able to create an entry into the custom table using the code below. I'm not sure how it works specifically on update and delete.

Here is my code for Behavior Definition:

managed implementation in class zcl_test unique;
strict(2);
define behavior for zv_test
persistent table z_custable
lockmaster
authorization master( instance )
{
create;
update;
delete;
action createUser result[1] $self;
}

Here for the class:

CLASS lhc_ZV_TEST DEFINITION INHERITING FROM cl_abap_behavior_handler.
PRIVATE SECTION.
METHODS get_instance_authorizations FOR INSTANCE AUTHORIZATION
IMPORTING keys REQUEST requested_authorizations for ZV_TEST RESULT result.

METHODS createUser FOR MODIFY
IMPORTING keys FOR ACTION zv_test-createUser RESULT result.

CLASS lhc_zv_test IMPLEMENTATION
METHOD createUser.
ENDMETHOD.
ENDCLASS.

 My question is, how do i implement the update and delete? is it implemented in the behavior definition? I'm not really exposed to this RAP. 

View Entire Topic
junwu
SAP Champion
SAP Champion

if it is managed, sap is doing those for you. if it is unmanaged, they have specific method for crud, just put your code there.