CRUD Operations in Odata – Part VI – Create Operation

CRUD Operations in Odata – Part VI – Create Operation

Redefine the ZEKKO12SET_CREATE_ENTITY method and write the below code.

DATA:lo_exception TYPE REF TO cx_root.
DATA:lv_message12 TYPE REF TO string.
TRY.
io_data_provider->read_entry_data(
IMPORTING
es_data                      = er_entity
).
CATCH cx_root INTO lo_exception.
ENDTRY.
IF er_entity IS NOT INITIAL.
INSERT INTO zekko12 VALUES er_entity.
ENDIF.

Click on Use as Request button.

If you don’t remove the highlighted entry and execute the POST HTTP Method as shown below the error 405 will come.

Enter the new entries in the HTTP Request as shown below

Entry is created with status code as 201.

Next is Update Operation

Advertisement

Leave a Comment