Coding a Virtual Attribute in a Subtype

Question: Hello SAPFans,

I'm trying to add an attribute to a subtype of an object. I've created ZBUS2078 as a deligated subtype of BUS2078. I'm trying to add an attribute 'Coordinator' to this new subtype.

I've chosen a virtual attribute, and in coding the virtual attribute I need to do a single read on table IHPA. The field I want to use as a search is already implemented as a database attribute in the supertype called VIQMEL. When I run the debugger I can see VIQMEL, but when I try use it in my code then the syntax fails: "Field "VIQMEL" is unknown. It is neither in one ...<SNIP>".

How can I get at that VIQMEL?

Any help would be greatly appreciated.

Ciao,
Swalt

Answer:
Hi,

Try something like this. we use it to get Work Center Object.


get_property workcenter changing container.
CONSTANTS:
lc_otype TYPE cr_objty VALUE 'A'.
DATA:
l_wcid TYPE cr_objid,
l_workcenter TYPE swc_object,
BEGIN OF lw_key,
werks TYPE werks_d,
arbpl TYPE arbpl,
END OF lw_key.

swc_get_property self 'WorkCenterID' l_wcid.

SELECT SINGLE arbpl FROM crhd INTO lw_key-arbpl
WHERE objty = lc_otype
AND objid = l_wcid.

SELECT SINGLE arbplwerk FROM viqmel INTO lw_key-werks
WHERE qmnum = object-key-number.

swc_create_object l_workcenter 'CRHD' lw_key.

object-workcenter = l_workcenter.

swc_set_element container 'WorkCenter' object-workcenter.

end_property.

Answer:
Howzit bucka,

It was the self reference that I was missing. I used the following:


DATA :                                           
  v_objnr LIKE qmel-objnr.                       
                                                 
swc_get_property self 'StatusObjNumber' v_objnr.

Thanks a million,
Swalt

Answer:
Hi,

If I did good can you vote for me?
_________________
Kind Regards,

Ron Johns
Copyright ?2007 - 2008 www.jt77.com