02-28-2022 10:45 AM - edited 02-04-2024 2:28 AM
I have one requirement to create Search Help in RAP model. in Item entity I have two fields based on which I want to fetch data. For eg. if profit center field is not initial then fetch from table1 elseif cost center is not initial then fetch from table2 else fetch from table3. How to write such logic? Am I suppose to write in my custom entity class? How will I access Item entity fields in my custom class for fetching data
if there is any other way please let me know.
Hello Ankit,
It can be done in 2 steps.
METHOD if_rap_query_provider~select.
DATA business_data TYPE t_business_data.
DATA(top) = io_request->get_paging( )->get_page_size( ).
DATA(skip) = io_request->get_paging( )->get_offset( ).
DATA(requested_fields) = io_request->get_requested_elements( ).
DATA(sort_order) = io_request->get_sort_elements( ).
DATA count TYPE int8.
TRY.
DATA(filter_condition) = io_request->get_filter( )->get_as_ranges( ).
<< custom logic to retrieve results based on filters >>
IF io_request->is_total_numb_of_rec_requested( ).
io_response->set_total_number_of_records( count ).
ENDIF.
IF io_request->is_data_requested( ).
io_response->set_data( business_data ).
ENDIF.
CATCH cx_root INTO DATA(exception).
DATA(exception_message) = cl_message_helper=>get_latest_t100_exception( exception )->if_message~get_longtext( ).
ENDTRY.
ENDMETHOD.
Best wishes,
Ramjee Korada
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Ramjee,
I tried this but it didn't work. filter_condition was initial in custom entity class. Please check image below, it is one of my requirment. In this lwa_node_itemdetail-lfdat is coming from item. how to get this lfdat in custom entity class you know so that i can write this logic and display the data
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.