2024 May 05 6:34 PM
I tried to execute with read call, data is coming but no error message https://1374dadc-372f-46e3-a692-b2bd57ae0ee4.abap-web.us10.hana.ondemand.com/sap/opu/odata4/sap/yap_....
unmanaged; //strict ( 2 ); define behavior for YAP_CDS_VIEW_NEW1 alias Testview implementation in class zbp_ap_cds_view_new1 unique //persistent table zfe_atrav_001031 //lock master authorization master ( instance ) //etag master <field_name> { }
CLASS lhc_YAP_CDS_VIEW_NEW1 DEFINITION INHERITING FROM cl_abap_behavior_handler. PRIVATE SECTION. data: keys TYPE TABLE FOR READ IMPORT yap_cds_view_new1, result TYPE TABLE FOR READ RESULT yap_cds_view_new1. METHODS get_instance_authorizations FOR INSTANCE AUTHORIZATION IMPORTING keys REQUEST requested_authorizations FOR yap_cds_view_new1 RESULT result. METHODS read FOR READ IMPORTING keys FOR READ yap_cds_view_new1 RESULT result. ENDCLASS. CLASS lhc_YAP_CDS_VIEW_NEW1 IMPLEMENTATION. METHOD get_instance_authorizations. READ ENTITIES OF yap_cds_view_new1 IN LOCAL MODE ENTITY Testview ALL FIELDS WITH CORRESPONDING #( keys ) RESULT DATA(results). DATA(lresult) = results[ 1 ]. APPEND VALUE #( %tky = lresult-%tky ) TO failed-Testview. APPEND VALUE #( %tky = lresult-%tky %msg = new_message_with_text( severity = if_abap_behv_message=>severity-error text = 'No Data Found' ) ) TO reported-Testview. ENDMETHOD. METHOD read. READ ENTITIES OF yap_cds_view_new1 IN LOCAL MODE ENTITY Testview ALL FIELDS WITH CORRESPONDING #( keys ) RESULT DATA(results). DATA(lresult) = results[ 1 ]. APPEND VALUE #( %tky = lresult-%tky ) TO failed-Testview. APPEND VALUE #( %tky = lresult-%tky %msg = new_message_with_text( severity = if_abap_behv_message=>severity-error text = 'No Data Found' ) ) TO reported-Testview. ENDMETHOD. ENDCLASS.
Thanks in advance Alok
2024 May 07 5:42 PM
Any update on this . Pls let me know .
2024 Jul 01 10:14 AM
2024 Aug 02 7:49 AM
@AlokKumar we're facing same issue. during GET method, the READ method is not getting triggered.
Could you let me know how you resolved it?
2024 Aug 03 2:10 PM
Read requests will be directly executed as queries on the underlying CDS entities.
And your read implementation won’t work, since that EML statement would result in a read again… you have to implement the transaction buffer by yourself.
2024 Oct 24 5:20 PM
Hello all,
I'm facing an issue with data storage in an unmanaged scenario. While I understand that reads are executed as queries on the underlying CDS entity, I'm unable to store the data in the behavior implementation since I'm using a service consumption model.
I would like to be able to store the data as it is read. The tutorials (like this one) suggest that the read operation should be triggered automatically. I've tried removing the "@ObjectModel.query.implementedBy:" annotation, but this results in an error indicating that data cannot be extracted from the database in a custom entity model. I've also attempted to create a database and set up an unmanaged scenario, but the read operation is still not being triggered.
If anyone has experience with getting read operations to work in an unmanaged scenario, I would greatly appreciate your guidance.
Best regards,
Rafael
2024 Oct 30 2:29 PM
Hello,
So I've looked into this and, if you've implemented an unmanaged BO (this is NOT QUERY), the "READ" method will only be triggered after Create / Update / Delete operation is executed, as the "Read modified entities" phase. A query scenario would trigger a "Select" method of our API if_rap_query_provider. The READ method of the BDef implementation, however, belongs to the transactional scenarios, not to the query case.
Basically, despite its name suggesting general read functionality, it does not handle initial data retrieval or general query operations.
Best regards,
Rafael
2024 Dec 21 12:40 PM
The GO button on the UI does not call the <method> FOR READ (the transactional READ) in the behavior pool. Instead, the GO button executes a query via the RAP runtime engine and reads data directly from the database.
The READ operation provides read access to the application buffer. It is used to retrieve data for further processing during the interaction phase. This is necessary, for example, for ETag comparison when executing an UPDATE