Reading an Object Reference from a Container
Prerequisites
The following prerequisites must be fulfilled to read an object reference of a BOR object from a container:
-
For function modules, the include file <CNTN01> must be incorporated in the program. For ABAP classes, the include files <CNTN02> and <CNTN03> must be incorporated. For more information, see Macro Instructions for Processing a Container.
-
The object references of the container must not be persistent.
Procedure
-
Create a variable for the object reference. Use the following command to do this:
DATA <Object> TYPE SWC_OBJECT.
-
Read the object reference from the container. Use the following command to do this:
SWC_GET_ELEMENT <Container> <Containerelement> <Object>.
You can read the object type and the key from the object reference. To do this, use the macros SWC_GET_OBJECT_TYPE and SWC_GET_OBJECT_KEY. For more information, see Macro Instructions for Accessing Objects, Attributes, and Methods.
DATA <Objekt> TYPE SWC_OBJECT
<Variable> LIKE SWOTOBJID.
SWC_GET_ELEMENT <Container> <Containerelement> <Variable>.
SWC_OBJECT_FROM_PERSISTENT <Variable> <Objekt>.