on 2025 Apr 04 6:39 AM
Hello Team,
I have created Unmanaged RAP V4 Web API OData service.
For READ operation I can see all data are coming. But when I am trying to access wrong key field data (which is not available in table) I am getting exception "Resource Not found". So, I have added some meaningful message in READ method. But that message is not coming. I have put debug point in READ method but when I am trying to GET call from GW Client debugger point not triggering.
What is the issue? Can you please help me?
Even when I am sending correct data from gw client, I am getting correct data without hitting breakpoint in READ method.
So, is READ method not triggering during GET call from OData V4 web api ?
Thanks
Request clarification before answering.
that's normal.
eml read will hit your read method.
odata query is hitting the cds if I am not wrong.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi DDEBORSHI,
May be the framework is bypassing the READ method. Just can you include use read; also in behaviour to force trigger read logic?
Also please ensure cache cleanups (/IWFND/CACHE_CLEANUP
/IWBEP/CACHE_CLEANUP) and Restart the Service (/IWFND/MAINT_SERVICE) as usual to get the changes reflected.
Thanks,
Arun
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
In the handler class, hope it is explicitly maintained (the read operation), I mean something like below: -
CLASS zcl_my_handler IMPLEMENTATION.
METHOD read_entity.
DATA: lt_data TYPE TABLE OF zmy_entity.
TRY.
SELECT * FROM zmy_entity
INTO TABLE lt_data
WHERE key_field = @Keys-key_field. " Use your key field
IF lt_data IS INITIAL.
RAISE EXCEPTION TYPE /iwbep/cx_mgw_busi_exception
EXPORTING textid = /iwbep/cx_mgw_busi_exception=>business_error
message = 'Record not found!'.
ENDIF.
result = lt_data. " Return the result
CATCH cx_sy_open_sql_db INTO DATA(lx_sql).
RAISE EXCEPTION TYPE /iwbep/cx_mgw_tech_exception
EXPORTING message = lx_sql->get_text( ).
ENDTRY.
ENDMETHOD.
ENDCLASS.and once this is there, can be please put a BP in this and see?
Thanks,
Arun
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
From my experience, the READ method is called when READ ENTITY EML is executed. For HTTP GET requests, data is read from the underlying CDS view.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
OData V4 handles read differently than OData V2.
Have you explicitly implemented readEntity?(custom logic in in Behavior Definition + Behavior Implementation), because In Unmanaged RAP, if you haven’t explicitly implemented readEntity, the framework might bypass your custom logic.
Thanks,
Arun
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 6 | |
| 6 | |
| 6 | |
| 5 | |
| 4 | |
| 3 | |
| 3 | |
| 3 | |
| 3 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.