How to add the plant code to BUS1001
Kjetil Kilhavn
kjetilk at statoil.com
Fri Jun 20 03:59:33 EDT 2003
First of all - the mailing list software is nice and complies with standard
internet e-mail, so all formatting is removed. Underlined lines are thus
hard to spot.
It took a while before I discovered the obvious. I would guess the last
line in the select statement is where it complains.
SELECT SINGLE * FROM marc CLIENT SPECIFIED
WHERE mandt = sy-mandt
AND matnr = object-key-material
AND werks = 2000
* AND plant2 = 2000.
AND object-plant2 = werks.
Is object-plant2 a field in table marc? I would not think so. Turn it
around
AND werks = object-plant2.
--
Kjetil Kilhavn
"Hoodak, Anthony J."
<AHoodak at Gleason.com To: SAP-WUG at MITVMA.MIT.EDU
> cc: (bcc: Kjetil Kilhavn)
Sent by: SAP Subject: How to add the plant code to BUS1001
Workflow
<Owner-SAP-WUG at MITVM
A.MIT.EDU>
19.06.2003 21:08
Please respond to
"SAP Workflow Users'
Group"
Greetings folks -
I have a BO ZBUS1001 which is a subtype of BUS1001. I need to add a plant
attribute to this subtype. I have done the following:
For an attribute, I did the following
Attribute Plant2
Object type ZBUS1001
Release 45B
Status released
Name Plant2
Description Plant2
Set up as a virtual attribute and the data type reference is set to ABAP
dictionary with the reference table and field being:
Reference table MARC
Reference field WERKS
In my program code, I have the following:
***** Implementation of object type ZBUS1001 *****
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,
material LIKE mara-matnr,
END OF key,
plant2 LIKE marc-werks,
_marc LIKE marc.
end_data object. " Do not change.. DATA is generated
TABLES marc.
*
get_table_property marc.
DATA subrc LIKE sy-subrc.
* Fill TABLES MARC to enable Object Manager Access to Table Properties
PERFORM select_table_marc USING subrc.
IF subrc NE 0.
exit_object_not_found.
ENDIF.
end_property.
*
* Use Form also for other(virtual) Properties to fill TABLES MARC
FORM select_table_marc USING subrc LIKE sy-subrc.
*DATA v_werks LIKE marc-werks.
*swc_get_element container 'Plant' v_werks.
* Select single * from MARC, if OBJECT-_MARC is initial
BREAK-POINT.
IF object-_marc-mandt IS INITIAL
AND object-_marc-matnr IS INITIAL
AND object-_marc-werks IS INITIAL.
SELECT SINGLE * FROM marc CLIENT SPECIFIED
WHERE mandt = sy-mandt
AND matnr = object-key-material
AND werks = 2000
* AND plant2 = 2000.
AND object-plant2 = werks.
subrc = sy-subrc.
IF subrc NE 0. EXIT. ENDIF.
object-_marc = marc.
ELSE.
subrc = 0.
marc = object-_marc.
ENDIF.
ENDFORM.
get_property plant2 changing container.
swc_set_element container 'Plant2' object-plant2.
end_property.
The problem is - in my code I keep getting the error "Field "OBJECT-PLANT2"
unknown" for the above underlined line (PS - I am not a seasoned ABAPer, so
I am just getting my feet wet here).
The problem is also, I am not getting the plant2 attribute populated when I
run a test. The attribute comes back blank. So I tried forcing the variable
"WERKS" to be populated with "2000" just to see if the value comes through.
Anyways - this is my approach and I am sure that I am close, but something
is not as I expected. So if you get a free minutes, please send me a line
and let me know what I am doing wrong here. I look forward to a bit of
guidance.
Thanks so much in advance!
Tony
-------------------------------------------------------------------
The information contained in this message may be CONFIDENTIAL and is
intended for the addressee only. Any unauthorised use, dissemination of the
information or copying of this message is prohibited. If you are not the
addressee, please notify the sender immediately by return e-mail and delete
this message.
Thank you.
More information about the SAP-WUG
mailing list