Calculation of interdependent virtual attributes

Weaver, Karen Karen.Weaver at Sonopress.com
Wed Apr 7 18:07:12 EDT 2004


You could invalidate your object by using   swc_refresh_object self.
 
The attributes are retrieved again.
 
-----Original Message-----
From: SAP Workflow [mailto:Owner-SAP-WUG at MITVMA.MIT.EDU]On Behalf Of
Patrice Nolin
Sent: Wednesday, April 07, 2004 6:01 PM
To: SAP-WUG at MITVMA.MIT.EDU
Subject: RE : Calculation of interdependent virtual attributes
 
 
Hi Karen,=20
 
We thought about something similar after sending the message. But we =
still
have a problem because the object is used in a loop. The 1st time it =
will be
ok, but if the data change in the system and we use INITIAL, it wont be
updated.
 
Also, we are force to use an attribute for calculation because the loop =
is a
sequence of screens and we don't want to cut the flow by using a =
background
method for calculation in a task.
 
Thanks
 
Pat
=20
------------------------------------------------------------------------=
----
Patrice Nolin, M.Sc.A. (courriel : nolin.patrice at hydro.qc.ca)
 
 
-----Message d'origine-----
De=A0: Weaver, Karen [mailto:Karen.Weaver at Sonopress.com]=20
Envoy=E9=A0: mercredi 7 avril 2004 16:52
=C0=A0: SAP-WUG at MITVMA.MIT.EDU
Objet=A0: Re: Calculation of interdependent virtual attributes
 
Couldn't you try the following:
 
OBJECT ...
 
begin of private,
hq_C like ...
end of private,
....
 
GET_PROPERTY HQ_B CHANGING CONTAINER.
  IF object-private-hq_c IS INITIAL.
    PERFORM set_hq_c.
  ENDIF.
  SWC_SET_ELEMENT CONTAINER 'hq_b' object-private-hq_c.
END_PROPERTY.
 
GET_PROPERTY HQ_A CHANGING CONTAINER.
  IF object-private-hq_c IS INITIAL.
    PERFORM set_hq_c.
  ENDIF.
  SWC_SET_ELEMENT CONTAINER 'hq_a' 2.
END_PROPERTY.
 
FORM set_hq_c.
  object-private-hq_c =3D 1.
ENDFORM.
 
-----Original Message-----
From: SAP Workflow [mailto:Owner-SAP-WUG at MITVMA.MIT.EDU]On Behalf Of
Patrice Nolin
Sent: Wednesday, April 07, 2004 4:01 PM
To: SAP-WUG at MITVMA.MIT.EDU
Subject: Calculation of interdependent virtual attributes
 
 
Hi,=20
 
I have an object with 2 virtual attributes : hq_A and hq_B=20
 
 
The formula for hq_A is select table TABLE_X and count every row=20
The formula for hq_B is select table TABLE_X and count rows meeting a
condition
 
For performance reason, since for hq_A and hq_B I need to access the =
same
data, I was thinking to put the code for calculation of hq_A and hq_B =
in
HQ_A attribute, setting a private variable hq_C and initiating hq_B =
with the
private variable hq_C (see example below):=20
 
My problem occurs when I use HQ_B before HQ_A because the content of =
the
private variable is calculated when HQ_A is referenced.
 
Is there another way to calculate my variables, without causing =
performance
problems?
Can we trigger the calculation of variables at the instantiation of the
object ?
 
Or what are you suggestion on the matter ?
 
Thanks
 
Pat
 
 
---------------------
 
Example :
 
OBJECT ...
 
begin of private,
hq_C like ...
end of private,
....
 
GET_PROPERTY HQ_B CHANGING CONTAINER.
  SWC_SET_ELEMENT CONTAINER 'hq_b' object-private-hq_c.
END_PROPERTY.
 
GET_PROPERTY HQ_A CHANGING CONTAINER.
  SWC_SET_ELEMENT CONTAINER 'hq_a' 2.
object-private-hq_c =3D 1.
END_PROPERTY.
 
 
 
Work well if I refer to HQ_A first. Then HQ_A =3D 2 and HQ_B =3D 1
Don't work well if I refer to HQ_B first. Then HQ_B =3D 0
 
 
------------------------------------------------------------------------=
----
Patrice Nolin, M.Sc.A. (courriel : nolin.patrice at hydro.qc.ca
<mailto:nolin.patrice at hydro.qc.ca> )
 


More information about the SAP-WUG mailing list