04-26-2011 10:13 AM
I created a query in a class called ZCL_CLASS in the method GET_ALL_EXAMPLES
due to the object services, like in the example of the book ABAP Objects on page 833:
GIVEN CODE:
-
DATA:
lt_objreftab TYPE STANDARD TABLE OF REF TO object
WITH DEFAULT KEY,
lo_query_mngr TYPE REF TO if_os_query_manager,
lo_query TYPE REF TO if_os_query.
create query-Manager
lo_query_mngr = cl_os_system=>get_query_manager( ).
Query without filter, to get all objects
lo_query = lo_query_mngr->create_query( ).
get all example objects
TRY.
CALL METHOD
zca_example=>agent->if_os_ca_persistency~get_persistent_by_query
EXPORTING
i_query = lo_query
i_parameter_tab =
i_par1 =
i_par2 =
i_par3 =
i_subclasses = OSCON_FALSE
i_upto = 0
RECEIVING
result = lt_objreftab.
CATCH cx_os_object_not_found .
CATCH cx_os_query_error .
ENDTRY.
-
RESULT:
But I just get the exception:
*!error: No implementation available
class CX_OS_NO_IMPLEMENTATION definition load.
raise exception type CX_OS_NO_IMPLEMENTATION exporting TEXTID = CX_OS_NO_IMPLEMENTATION=>SUBCLASS.
There seems to be no local class CX_OS_NO_IMPLEMENTATION.
-
QUESTION:
What went wrong? I'm expecting to get all persistent objects from the underlying table Z_EXAMPLE.
Should I simply create the class CX_OS_NO_IMPLEMENTATION myself?
I'm working with SAP_ABA 700 Lev. 0022
04-26-2011 10:37 AM
Hello Mario,
You're getting the exception CX_OS_NO_IMPLEMENTATION in the method GET_PERSISTENT_BY_QUERY. This is because this method is not re-defined in the Base Class i.e., ZCB_EXAMPLE!
Please refer to the persistent class CL_SPFLI_PERSISTENT & the demo program DEMO_QUERY_PERSISTENT for further details.
BR,
Suhas
04-26-2011 10:37 AM
Hello Mario,
You're getting the exception CX_OS_NO_IMPLEMENTATION in the method GET_PERSISTENT_BY_QUERY. This is because this method is not re-defined in the Base Class i.e., ZCB_EXAMPLE!
Please refer to the persistent class CL_SPFLI_PERSISTENT & the demo program DEMO_QUERY_PERSISTENT for further details.
BR,
Suhas
04-26-2011 2:11 PM
Ok. This is true.
But it seems to me too much effort redefining the method like in the example class. And even more methods like 'map_initialize_data' need to be implemented.
That's nearly the same what I get with one line of basic abap code:
select * from table into table in the class
instead of calling
IF_OS_CA_PERSISTENCY~GET_PERSISTENT_BY_QUERY.
Edited by: Mario Schmidt on Apr 26, 2011 9:20 AM
04-26-2011 3:53 PM
Hello Mario,
I also had the same dilemma few days back: I am sure you will like Harald's response.
But it seems to me too much effort redefining the method like in the example class. And even more methods like 'map_initialize_data' need to be implemented.
You don't have to re-define these methods. The methods are automatically redefined by the system when you complete the OR mapping! Did you complete the OR mapping in your persistence class?
Cheers,
Suhas
04-27-2011 8:57 AM
Hi Suhas,
> You don't have to re-define these methods. The methods are automatically redefined by the system when you complete the OR mapping! Did you complete the OR mapping in your persistence class?
That was the point. In the generator settings, I did forget to set the hook for getting the query-method generated (F5 in the persistence view in the class). So it was simply missing and was not generated.
I redefined the method of the class already all by myself, but I think I'll delete it, to see If there's even more which will be generated, because the method has only been generated in the base agent.
Thanks,
Mario