Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Retrieve a persistent object without the primary key

Former Member
0 Likes
746

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.

4 REPLIES 4
Read only

naimesh_patel
Active Contributor
0 Likes
688

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

Read only

0 Likes
688

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.

Read only

0 Likes
688

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

Read only

0 Likes
688

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.