11-21-2011 1:27 PM
Hello,
I'm a new developer with SAP/ABAP and I play with the persistent objects. I would know if it's possible to find an object in a table with another field than the primary key or without field to retrieve all lines in a table. Can you help me?
Thanks a lot.
11-21-2011 5:11 PM
You can use Query services to get the persistent objects using other fields. Read more about query services on help at: http://help.sap.com/saphelp_nw70/helpdata/en/ce/586e42472adc54e10000000a155106/frameset.htm
Regards,
Naimesh Patel
11-21-2011 7:26 PM
I seen your solution but I have another question. Is there a way to generate a method in my agent?
I want to do something like this :
agent->get_persistent_by_query( 'Name = Corbel' ) '' To retrieve all the line where the name is "Corbel"
agent->get_all_persistent( ) '' To retrieve all lines
My question is may be simple but I am very new with abap.
11-21-2011 7:30 PM
Persistent object represents a Single row of data in the DB. So, if you add the methods in your agents, you still need to instantiate several persistent objects as per your result set.
Regards,
Naimesh Patel
11-21-2011 8:20 PM
So, if I understand, the persistent classes represents a single row and there is no way to generate a code which is able to find several lines. If I want to have this kind of functions I must to implement them manualy with the method if_os_ca_persistency~get_persistent_by_query. I think than that is missing. I'm a fan of Ruby On Rails and I think than ActiveRecord will miss me.
Thanks for your answer.