Reading and Writing Attributes of a Business Object

Mike Pokraka wug at workflowconnections.com
Fri Mar 5 10:38:20 EST 2010


Yes, Florin's answer perfectly addresses your question - and it made me
happy :-)

However I would question why you're trying to do this in first place. Your
technique goes against OO 'best practice'. Strictly speaking, an object
component should be self-contained and you should only ever access another
attribute via the standard methods e.g.:
swc_get_property self 'MyAttributeName' lv_var
instead of using OBJECT-... directly. The reason is to avoid exactly the
situation you had. Each attribute's code is responsible for it's own
attribute, nothing else!

If it is more efficient to populate a bunch of attributes in one go, then
put this code into a subroutine which you can call from all the
attributes. This is similar to how DB attributes work, by putting the
SELECT statement into one FORM which is called by all the DB attributes
for one table.

Cheers,
Mike


On Fri, March 5, 2010 1:36 pm, Ali Husain wrote:
>
>
> Hey Florin,
>
> I've done what you have suggested and it worked for both cases (Reading &
> writing). Thanks a lot for the great detailed explanation. You did mention
> to be careful for endless loops when using get_property with database
> attributes, how would they occur and how to avoid them?
>
> Thanks a lot again for your help.
> Ali
>
>
>
>





More information about the SAP-WUG mailing list