Private attributes in object type
Mike Gambier
madgambler at hotmail.com
Fri Sep 29 10:05:54 EDT 2006
A private attribute can only be set (buffered) inside the instance code,
i.e. the object buffers it in its own stack.
Standard OO stuff really only with a SAP twist; 'private' means it belongs
to the object and only the object can see it or do anything with it. But as
far as SW01 is concerned you can't see these attributes, unlike ABAP Objects
and SE24 where you can.
Such a field could be set with a value at runtime during a virtual attribute
definition, a method (e.g. ExistenceCheck) or even in a common subroutine
called at some point in the code by both.
I have seen people write methods that allow values to be received from
outside of the object instance and pass these through into private
attributes, but I must admit I have never really needed to do this myself as
I have found that the life-cycle of an actual instance at runtime is too
short to bother, so far.
By the way, I have never seen private attributes used in an
instance-independent sense but I suppose they could.
Be aware of object buffering and remember that if an object has already been
instantiated the value of something like OBJECT-PRIVATE may already be
populated in memory, especially if you have implemented something in
ExistenceCheck (i.e. during instantiation) to set it from the start. It's
handy sometimes to prefix code that may attempt to use such a private
attribute with:
IF object-private-<attribute> IS INITIAL.
PERFORM <fetch attribute>
ELSE.
<use attribute>
ENDIF.
SAP use this a lot, particularly with instance attributes. Trouble is though
that sometimes the buffer can be lost and you end up with null instances,
but that's a SAP 'feature' apparently.
Also a word of warning: if the attribute's value is likely to change
frequently then it's probably not worth buffering at all!
The whole concept is like Global Memory in an ABAP Report, because
effectively that's exactly what is. The value will be discarded when the
instance is thrown away (and the call to the BOR Object report ended).
Remember that nothing 'private' is EVER written to the database.
MGT
>From: "Edward Diehl" <edwarddiehl at hotmail.com>
>Reply-To: "SAP Workflow Users' Group" <sap-wug at mit.edu>
>To: sap-wug at mit.edu
>Subject: RE: Private attributes in object type
>Date: Fri, 29 Sep 2006 08:26:36 -0500
>
>
>
>I think Josef's question here (and mine, too) is how do (where do) you
>assign a value to the private attribute - not how do you retrieve the
>value.
>
>Correct Josef?
>
>My follow-on question is, When is a private attribute better than a public?
>
>Thanks,
>
>Ed Diehl
>
>
>
>
>
>
>From: "Mike Gambier" <madgambler at hotmail.com>
>Reply-To: "SAP Workflow Users' Group" <sap-wug at mit.edu>
>To: sap-wug at mit.edu
>Subject: RE: Private attributes in object type
>Date: Fri, 29 Sep 2006 12:15:00 +0000
> >Actually, Alon, if I'm not mistaken (and I've read Josef's mail
> >correctly) the correct syntax here would be:
> >
> >object-private-private_attribute
> >
> >I find it helpful to imagine 'private' as a structure :)
> >
> >Make sure you generate your BOR Object after your changes and
> >synchronise the buffers using SWU_OBUF to make sure the new version
> >is available and being used.
> >
> >Regards,
> >
> >MGT
> >
> >>From: "Alon Raskin"
><araskin at 3i-consulting.com>
> >>Reply-To: "SAP Workflow Users' Group" <sap-wug at mit.edu>
> >>To: "SAP Workflow Users' Group" <sap-wug at mit.edu>
> >>Subject: RE: Private attributes in object type
> >>Date: Fri, 29 Sep 2006 08:00:18 -0400
> >>
> >> >From within your BOR, Use object-private_attribute to access your
> >>attribute.
> >>
> >>Alon Raskin
> >>
> >>-----Original Message-----
> >>From: sap-wug-bounces at mit.edu [mailto:sap-wug-bounces at mit.edu] On
> >>Behalf Of Josef Herwig
> >>Sent: 29 September 2006 07:40
> >>To: sap-wug at mit.edu
> >>Subject: Private attributes in object type
> >>
> >>Hello workflow friends,
> >>
> >>does any body of you has ever used private attributes in object
> >>types?
> >>
> >>i
>heared that such an attribute can be set during the creation of
> >>the
> >>object type instance. than it should be available as global value.
> >>is this correct?
> >>
> >>i've got the definition managed but i could not assign a value to
> >>it.
> >>does someone knows how?
> >>
> >>INCLUDE <object>.
> >>begin_data object. " Do not change.. DATA is generated
> >>* only private members may be inserted into structure private
> >>DATA:
> >>" begin of private,
> >>" to declare private attributes remove comments and
> >>" insert private attributes here ...
> >>" end of private,
> >> BEGIN OF key,
> >>
> >>
> >>My coding:
> >>
> >> begin of private,
> >>" to declare
>private attributes remove comments and
> >>" insert private attributes here ...
> >> private_attribute type char10,
> >> end of private,
> >> BEGIN OF key,
> >>
> >>
> >>
> >>Kind Regards,
> >>Josef
> >>
> >>
> >>--
> >>GMX DSL-Flatrate 0,- Euro* - Überall, wo DSL verfügbar ist!
> >>NEU: Jetzt bis zu 16.000 kBit/s! http://www.gmx.net/de/go/dsl
> >>_______________________________________________
> >>SAP-WUG mailing list
> >>SAP-WUG at mit.edu
> >>http://mailman.mit.edu/mailman/listinfo/sap-wug
> >>
> >>_______________________________________________
> >>SAP-WUG mailing list
> >>SAP-WUG at mit.edu
> >>http://mailman.mit.edu/mailman/listinfo/sap-wug
> >
> >
>
>
> >_______________________________________________
> >SAP-WUG mailing list
> >SAP-WUG at mit.edu
> >http://mailman.mit.edu/mailman/listinfo/sap-wug
>
>
>
>
>_______________________________________________
>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