Hello experts,
I've recently started developing a project using the Persistent Object Service, and I'm currently struggling on how to Retrieve more than one persistent object at a time, using a incomplete Business Key.
For example, let's say we have a Persistent Class for table SFLIGHT ( Using Business Key ). The Business Key for this class, is going to be all the primary key fields from the table :
That being said, If I want to get a persistent object, I have to specify all 3 fields to the GET_PERSISTENT Method, such as :
persistent_object = zca_sflight=>agent->get_persistent( EXPORTING i_carrid = 'AA' i_connid = '0017' i_fldate = '20140917 )
Let's say, I need ALL Persistent Objects from Company AA. How do I achieve that, WITHOUT using any SELECT Statement ?
For example:
table_of_persistent_objects = zca_sflight=>agent->get_persistent_table( EXPORTING i_carrid = 'AA' )
One of my initial solutions, was implementing method IF_OS_CA_PERSISTENCY~GET_PERSISTENT_BY_QUERY, and using a FILTER like so :
lo_query_manager = cl_os_system=>get_query_manager( ).
lo_query = lo_query_manager->create_query( i_filter = `CARRID = PAR1 ).
zca_sflight=>agent->if_os_ca_persistency~get_persistent_by_query( EXPORTING i_query = lo_query i_par1 = 'AA' RECEIVING result = table_of_objects ).
And that almost worked. The only problem using the method GET_PERSISTENT_BY_QUERY is that it ONLY gets data that is already in the database.
So let's say I recently created a persistent object for SFLIGHT, and didn't commit work yet. The object exists in cache, but there is no entry for it in the Database Table, so if I call method GET_PERSISTENT_BY_QUERY, that object would not be returned.
I need something that works the same way GET_PERSISTENT does ( Considering objects from CACHE and Database ), but can return lists of objects using incomplete business keys.
PS: Methods like GET_PERSISTENT_BY_KEY_TAB won't work, because even though they return a table of objects, they still require a table of complete business keys.
Thank you in advance,