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

populating base structure from persistent object

mike_mcinerney
Participant
0 Likes
433

Let's say I create a peristent class, ZCL_PWIDGET.

ZCA_PWIDGET and ZCB_PWIDGET are created on my behalf.

Let's say I map data in all the fields from table ZWIDGET .

ZWIDGET has 1 Key field, KEY1, and five data fields, C1-C5.

I think I can retrieve data from the tables and create a runtime instance of my class using


DATA:  this_widget TYPE REF TO zcl_pwidget.
this_widget=>agent->get_persistent( I_KEY1= '1234' ). 

Can someone tell me how to populate wa_widget ( I think I can use a map attributes call, but I don't quite understand how).


Data : wa_widget type zwidget.

Thanks...

...Mike

3 REPLIES 3
Read only

naimesh_patel
Active Contributor
0 Likes
414

In your persistence class you must have the SET_ and GET_ methods.

Use GET_C1 method to get the value of the field C1.

Like:

wa_widget-c1 = this_widget=>agent->get_c1( ).

Regards,

Naimesh Patel

Read only

mike_mcinerney
Participant
0 Likes
414

Thanks, but I'm looking for a way to populate wa_widget in one fell swoop.

Is there a way to populate all (or most) of the fields of wa_widget at one time, like...


wa_widget = this_widget->get_ALL_fields_from_persistent_mapping

How do folks do this in practice ?

Thanks...

...Mike

Read only

0 Likes
414

Don't believe that a method that will return all fields will be generated for you. If you want something like that, you can create your own custom method in the class that will just call the necessary GET methods for you and return the values.