CRUD Operations in Odata – Part VI – Create Operation
Redefine the ZEKKO12SET_CREATE_ENTITY method and write the below code.
DATA:lo_exceptionTYPEREFTOcx_root. |
|
DATA:lv_message12TYPEREFTOstring. |
|
TRY. |
|
io_data_provider->read_entry_data( |
|
IMPORTING |
|
es_data=er_entity |
|
). |
|
CATCHcx_rootINTOlo_exception. |
|
ENDTRY. |
|
IFer_entityISNOTINITIAL. |
|
INSERTINTOzekko12VALUESer_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