AW: getting an attribute

Jose Burgman [AST] jose.burgman at ast.co.za
Tue Oct 1 03:43:21 EDT 2002


Hi Tomasz
 
Thanks for the info - if you look at the start of the thread you'll see =
I declared the material attribute as an object. But this is not the =
problem. To explain I'll use your terminology. I have the key for =
VBAPOBJ. When I try and access the material attribute of VBAPOBJ, the =
system passes the key to the VBAPOBJ program running in the background - =
I've put the SAP standard code below.=20
 
 INCLUDE <OBJECT>.                                       =20
 BEGIN_DATA OBJECT. " Do not change.. DATA is generated  =20
 * only private members may be inserted into structure pri
 DATA:                                                   =20
 " begin of private,                                     =20
 "   to declare private attributes remove comments and   =20
 "   insert private attributes here ...                  =20
 " end of private,                                       =20
   BEGIN OF KEY,              =3D=3D=3D=3D=3D=3D> This gets filled with =
the info from VBAPOBJ correctly             =20
       SALESDOCUMENTNO LIKE VBAP-VBELN,                  =20
       ITEMNO LIKE VBAP-POSNR,                           =20
   END OF KEY,                                           =20
       MATERIAL TYPE SWC_OBJECT,                         =20
       SALESDOCUMENT TYPE SWC_OBJECT,                    =20
       _VBAP LIKE VBAP.                                  =20
 END_DATA OBJECT. " Do not change.. DATA is generated    =20
                                                         =20
 TABLES VBAK. =20
TABLES VBAP.                                                 =20
GET_PROPERTY MATERIAL CHANGING CONTAINER.                    =20
DATA SUBRC LIKE SY-SUBRC.                                    =20
DATA:                                                        =20
  BEGIN OF KEY_BUS1001,                                      =20
    MATNR LIKE MARA-MATNR,                                   =20
  END OF KEY_BUS1001.                                        =20
  PERFORM SELECT_TABLE_VBAP USING SUBRC.  =3D=3D=3D=3D=3D> the key is =
corrupted when it gets here                   =20
  IF SY-SUBRC NE 0.                                          =20
    EXIT_OBJECT_NOT_FOUND.                                   =20
  ENDIF.                                                     =20
                                              =20
What confuses me is that when I test the object VBAP in SWO1 by creating =
an instance, the corruption does not occur.=20
 
Anyway, I did a workaround. I created a structure and copied the VBAPOBJ =
key to it and then read the VBAP table directly to get my info. I'm just =
curious why the key gets corrupted in the role, and not when creating an =
instance.
 
Regards
 
Jose
 
-----Original Message-----
From: Zmudzin,Tomasz,VEVEY,GL-DS/DM [mailto:Tomasz.Zmudzin at nestle.com]
Sent: Tuesday, October 01, 2002 7:58 AM
To: SAP-WUG at MITVMA.MIT.EDU
Subject: Re: AW: getting an attribute
 
 
Jose,
 
* please note that the key of 'material' is actually a key of a business
object typed 'VBAP' (composed of client number, "VBAP" string and the =
rest
of the key shifted accordingly").
* when you query the 'MATERIAL' property of this business object, you =
get an
object reference in return (please check the attribute definition -- =
it's
'object', not DDIC). So again it's not just a plain number -- it's a =
living
object. So its key is also composed of the client number, business =
object
type, and the material key. If you want to get the object key only =
(=3Dthe
number of the material, 18 chars long), use the offset -- or even =
better,
the following coding:
 
data: matnr_nr like mara-matnr.
 
SWC_CREATE_OBJECT VBAPOBJ 'VBAP' matobj.
SWC_GET_PROPERTY VBAPOBJ 'MATERIAL' matnr.
SWC_GET_OBJECT_KEY matnr matnr_nr.
 
and you'll have it in the matnr_nr variable.
 
The key thing is again to distinguish between an object and a plain
variable. An object has its own living -- you can ask it to do something
(method call) or query its properties. It's different from a number
identifying the instance (e.g. material '4711'). You cannot do the same =
with
that number -- cannot ask it to display itself. So the object is more =
than
just this number. For certain important reasons its key is thus composed =
of
all the other elements too which shift that "number" in the display. At
least that allows you to differentiate between a '4711' material and =
'4711'
customer, which are simply different creatures.
 
Kind regards,
Tomasz
 
P.S. 1: For readability I'd suggest to rename
 
MATOBJ   --> VBAPOBJ
MATNR    --> MATERIAL
MATNR_NR --> MATNR
 
P.S. 2: As of the number-object difference: As a nice exercise try =
following
this up in SWO1 test mode...
 
-----Original Message-----
From: Jose Burgman [AST] [mailto:jose.burgman at ast.co.za]
Sent: Monday,30. September 2002 18:21
To: SAP-WUG at MITVMA.MIT.EDU
Subject: Re: AW: getting an attribute
 
 
The key gets passed across to VBAP OK during swc_get_property. When VBAP
calls the method to get the material, the key for material seems to get
scrambled - the sales document no and item no don't go across OK - the =
item
contains the value VBAP (!) and sales doc no is a space. Obviously when
looking up on the table it doesn't find the information.
 
I tested the object VBAP in swo1, there it does it correctly. I looked =
on
OSS and didn't find any references. So....I'm a bit stumped.
 
Jose
 
-----Original Message-----
From: Zmudzin,Tomasz,VEVEY,GL-DS/DM [mailto:Tomasz.Zmudzin at nestle.com]
Sent: Monday, September 30, 2002 5:56 PM
To: SAP-WUG at MITVMA.MIT.EDU
Subject: Re: AW: getting an attribute
 
 
Where exactly does this thing fail?
 
Cheers, T.
 
-----Original Message-----
From: Jose Burgman [AST] [mailto:jose.burgman at ast.co.za]
Sent: Monday,30. September 2002 17:05
To: SAP-WUG at MITVMA.MIT.EDU
Subject: Re: AW: getting an attribute
 
 
Hi there
 
I tried this and it did not work. The key does not seem to get passed =
across
when i try and get the attribute. It's probably something simple that =
I'm
doing wrong, but blow me over if I can pick it up!
 
Thanks.
 
Jose
 
-----Original Message-----
From: Zmudzin,Tomasz,VEVEY,GL-DS/DM [mailto:Tomasz.Zmudzin at nestle.com]
Sent: Monday, September 30, 2002 3:13 PM
To: SAP-WUG at MITVMA.MIT.EDU
Subject: Re: AW: getting an attribute
 
 
Actually I think the name of the container element misled Heinz -- you =
need
an instance of VBAP to query its properties:
 
SWC_CREATE_OBJECT VBAPOBJ 'VBAP' matobj.   " or its part that contains =
the
key
SWC_GET_PROPERTY VBAPOBJ 'MATERIAL' matnr.
 
Tomasz
 
 
-----Original Message-----
From: Jose Burgman [AST] [mailto:jose.burgman at ast.co.za]
Sent: Monday,30. September 2002 14:59
To: SAP-WUG at MITVMA.MIT.EDU
Subject: Re: AW: getting an attribute
 
 
Material is an attribute of the object VBAP so an instance should exist =
- I
think the problem is that the key from VBAP is not being passed across =
to
the get property macro - these fields contain no value when I'm in debug
mode in the macro itself.
 
Jose
 
-----Original Message-----
From: Schmidinger, Heinz (Unaxis IT BZ)
[mailto:heinz.schmidinger at unaxis.com]
Sent: Monday, September 30, 2002 2:43 PM
To: SAP-WUG at MITVMA.MIT.EDU
Subject: AW: getting an attribute
 
 
is an instance of object 'BUS1001' avaiable at this time ?
Otherwise maybe you shoud do swc_create_object 'BUS1001' mat_key
 
-----Urspr|ngliche Nachricht-----
Von: Jose Burgman [AST] [mailto:jose.burgman at ast.co.za]
Gesendet am: Montag, 30. September 2002 14:11
An: SAP-WUG at MITVMA.MIT.EDU
Betreff: getting an attribute
 
Hi every-one
 
Well, I've got to a point where I'm not sure how to proceed. I'm in the
process of creating a standard role. The position is determined by the
material number - I'm using BUS2030 (Customer Inquiry)as a starting =
point.
In BUS2030 the items are a multiline element (of type VBAP) - I pass =
this to
my standard role and extract the table (of type VBAP, called material). =
I
read the first line of the table and I seem to get a key. When I try and =
get
the material property (also an object BUS1001), no information is =
returned.
In debug mode it seems the key is not passed across and I get nothing =
back
for my material, although the key shows in my extracted object.
 
ie
  DATA: material TYPE swc_object OCCURS 0,
        matobj TYPE swc_object,
        matnr TYPE swc_object.
 
  swc_get_table ac_container 'Material' material. =3D=3D=3D=3D=3D> =
material filled
with table
  READ TABLE material INDEX 1 INTO matobj. =3D=3D=3D=3D=3D=3D> matobj =
filled
  swc_get_property matobj 'Material' matnr.  =3D=3D=3D=3D=3D> matnr not =
filled. In
debug mode, the key in
matobj is not passed across to the implementation
program.
 
Can any-one tell me what I'm doing wrong?
 
Thanks
 
Jose.
______________________________________________
 
"This information is intended only for the person or entity to which it =
is
addressed and
may contain private, confidential, proprietary and/or privileged =
material
and may be subject
to confidentiality agreements.
 
Any review, retransmission, dissemination, or any other use of or taking =
of
any action in
reliance upon this information, by persons or entities other than the
intended recipient,
is prohibited.
 
If you received this in error, please contact the sender and delete the
material from all
storage media.
 
The company is neither liable for proper, complete transmission of the
information contained
in this communication, any delay in its receipt or that the mail is
virus-free"
______________________________________________
 
"This information is intended only for the person or entity to which it =
is
addressed and
may contain private, confidential, proprietary and/or privileged =
material
and may be subject
to confidentiality agreements.
 
Any review, retransmission, dissemination, or any other use of or taking =
of
any action in
reliance upon this information, by persons or entities other than the
intended recipient,
is prohibited.
 
If you received this in error, please contact the sender and delete the
material from all
storage media.
 
The company is neither liable for proper, complete transmission of the
information contained
in this communication, any delay in its receipt or that the mail is
virus-free"
______________________________________________
 
"This information is intended only for the person or entity to which it =
is
addressed and
may contain private, confidential, proprietary and/or privileged =
material
and may be subject
to confidentiality agreements.
 
Any review, retransmission, dissemination, or any other use of or taking =
of
any action in
reliance upon this information, by persons or entities other than the
intended recipient,
is prohibited.
 
If you received this in error, please contact the sender and delete the
material from all
storage media.
 
The company is neither liable for proper, complete transmission of the
information contained
in this communication, any delay in its receipt or that the mail is
virus-free"
______________________________________________
 
"This information is intended only for the person or entity to which it =
is
addressed and
may contain private, confidential, proprietary and/or privileged =
material
and may be subject
to confidentiality agreements.
 
Any review, retransmission, dissemination, or any other use of or taking =
of
any action in
reliance upon this information, by persons or entities other than the
intended recipient,
is prohibited.
 
If you received this in error, please contact the sender and delete the
material from all
storage media.
 
The company is neither liable for proper, complete transmission of the
information contained
in this communication, any delay in its receipt or that the mail is
virus-free"
______________________________________________
 
"This information is intended only for the person or entity to which it is addressed and
may contain private, confidential, proprietary and/or privileged material and may be subject
to confidentiality agreements.
 
Any review, retransmission, dissemination, or any other use of or taking of any action in
reliance upon this information, by persons or entities other than the intended recipient,
is prohibited.
 
If you received this in error, please contact the sender and delete the material from all
storage media.
 
The company is neither liable for proper, complete transmission of the information contained
in this communication, any delay in its receipt or that the mail is virus-free"
 


More information about the SAP-WUG mailing list