Reading and Writing Attributes of a Business Object

Mike Pokraka wug at workflowconnections.com
Mon Mar 8 06:35:43 EST 2010


In that case I'd suggest defining an attribute 'Approver' as type employee
object. Then all the approver object's attribute are available to use
without any further work.


On Sun, March 7, 2010 11:55 am, Ali Husain wrote:
>
>
> Hey Mike,
>
> The reason i wanted this was because the key of my business object is the
> employee number. I need to retrieve his approver which depends on custom
> criteria in our company. So initially, i need the employee number of the
> approver. From that i was calling a function module to get many
> information about him like his user ID, name, etc. I wanted each of those
> values to be separate attributes, for example like his user ID which i can
> use to send him the work item and then the other information as well.
>
> I see what you are saying in that each attribute should be respobsible for
> its own code only. In my case it's enough to know the emp number of the
> approver to retireve most of the informaiton i need. So i think i could
> just use swc_get_property self 'MyAttributeName' lv_var to get the emp
> number and then use the same function module inside each attribute and
> assign it the corresponding value or probably retrieve it directly from
> the relevant database tables.
>
> I do think that Florin's technique was a slick one and i wanted to give it
> a try. Probably will not use it again for the reason you have suggested.
>
> Thanks both for your inputs.
> Ali
>
>
>> From: sap-wug-request at mit.edu
>> Subject: SAP-WUG Digest, Vol 64, Issue 11
>> To: sap-wug at mit.edu
>> Date: Fri, 5 Mar 2010 12:06:24 -0500
>>
>> Send SAP-WUG mailing list submissions to
>> 	sap-wug at mit.edu
>>
>> To subscribe or unsubscribe via the World Wide Web, visit
>> 	http://mailman.mit.edu/mailman/listinfo/sap-wug
>> or, via email, send a message with subject or body 'help' to
>> 	sap-wug-request at mit.edu
>>
>> You can reach the person managing the list at
>> 	sap-wug-owner at mit.edu
>>
>> When replying, please edit your Subject line so it is more specific
>> than "Re: Contents of SAP-WUG digest..."
>>
>>
>> Today's Topics:
>>
>>    1. RE: Reading and Writing Attributes of a Business Object
>>       (Mike Pokraka)
>>
>>
>> ----------------------------------------------------------------------
>>
>> Message: 1
>> Date: Fri, 5 Mar 2010 15:38:20 -0000 (GMT)
>> From: "Mike Pokraka" <wug at workflowconnections.com>
>> Subject: RE: Reading and Writing Attributes of a Business Object
>> To: "SAP Workflow Users' Group" <sap-wug at mit.edu>
>> Message-ID:
>> 	<c70a5a415aabc40231efaca7390b1347.squirrel at g.mail.aaisp.net.uk>
>> Content-Type: text/plain;charset=iso-8859-1
>>
>> 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
>> >
>> >
>> >
>> >
>>
>>
>>
>>
>> ------------------------------
>>
>> _______________________________________________
>> SAP-WUG mailing list
>> SAP-WUG at mit.edu
>> http://mailman.mit.edu/mailman/listinfo/sap-wug
>>
>>
>> End of SAP-WUG Digest, Vol 64, Issue 11
>> ***************************************
>
> _________________________________________________________________
> Hotmail: Trusted email with Microsoft’s powerful SPAM protection.
> http://clk.atdmt.com/GBL/go/201469226/direct/01/_______________________________________________
> SAP-WUG mailing list
> SAP-WUG at mit.edu
> http://mailman.mit.edu/mailman/listinfo/sap-wug
>





More information about the SAP-WUG mailing list