Virtual Attribute not working as expected.

Dart, Jocelyn jocelyn.dart at sap.com
Thu Aug 12 18:29:02 EDT 2004


Hi Rick,
There is definitely no requirement to have at least one DB attribute - I've created objects without them without any problems.
 
A couple of things to watch out for:
a) In earlier releases (pre 4.7) especially, sometimes when you first create the business object, the object key section is not generated correctly.  This can cause errors.  Fix by going out of transaction SWO1 and returning to it - that's all you have to do and the second time it always works...
b) If your object is a delegated object, check your delegation settings.
c) After you generate your object or change delegation settings, go to SWU_OBUF and refresh the buffer before attempting to use your new attributes.  If you have your test sitting ready in another transaction e.g. SWUS, make sure you restart the test transaction to pick up the new buffer values before you run the test.
 
Your new virtual attribute code looks better - yes you must use SWC_GET_PROPERTY self.. to get the other attributes - as there is no guarantee as to the order in which attributes are calculated.   However if CreatedBy is an object (SWC_OBJECT?) then you need to get the property of CreatedBy that holds the userid as well e.g. sWC_GET_PROPERTY CreatedBy 'UserID' ... etc. if 'UserID' is the name of the user id attribute.
 
GET_PROPERTY ZCREATOR CHANGING CONTAINER.
 DATA: CreatedBy TYPE SWC_OBJECT.
 SWC_GET_PROPERTY SELF 'CreatedBy' CreatedBy.
 CONCATENATE 'US' CreatedBy INTO OBJECT-ZCREATOR.
 SWC_SET_ELEMENT CONTAINER 'zCreator' OBJECT-ZCREATOR.
END_PROPERTY.
 
 
Rgds,
Jocelyn
 
-----Original Message-----
From: SAP Workflow [mailto:Owner-SAP-WUG at MITVMA.MIT.EDU] On Behalf Of Mark Huffman
Sent: Friday,13 August 2004 2:57 AM
To: SAP-WUG at MITVMA.MIT.EDU
Subject: Re: Virtual Attribute not working as expected.
 
Rick,
 
If  you can get a copy of SAP-Press 'Practical Workflow for SAP' on pg 473
they have
an example of ZDEADLINE, a custom object with only virtual attributes.
 
I have used this object / code on several projects and have never had a
problem with object
generation. I suspect your generation problem is specific to your object
implementation
and not an SAP issue.
 
best regards
 
Mark
 
----- Original Message -----
From: "Rick Sample" <Rick.Sample at gbe.com>
To: <SAP-WUG at MITVMA.MIT.EDU>
Sent: Thursday, August 12, 2004 10:20 AM
Subject: Virtual Attribute not working as expected.
 
 
I have a BO with DB attributes and Virtual attributes.
 
In SWO1 test, the below works. zCreator gets populated.
When I Create event in SWUE and start the WF,
all I get is 'US' and my DB attributes. Non of my Virtual attributes are
being populated via SWUE an set in the WF containers.
I have my bindings set in the WF.
 
Also,
If I do not have at least one DB Attribute I get errors and object won't
even generate.
?
 
4.6c
 
 
GET_PROPERTY ZCREATOR CHANGING CONTAINER.
  DATA: l_Creator LIKE WFSYST-INITIATOR.
  CONCATENATE 'US' ZNSRH-CREATOR INTO l_Creator.
  SWC_SET_ELEMENT CONTAINER 'zCreator' l_Creator.
END_PROPERTY.
 
Rick Sample
WF Developer
Graybar, Inc.
 


More information about the SAP-WUG mailing list