Start of Content Area

Procedure documentation Reading an Object Reference from a Container  Locate the document in its SAP Library structure

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.

Note

These prerequisites are always fulfilled if you are in the implementation program. The container is then addressed with the name CONTAINER.

·         The object references of the container must not be persistent.

Note

Containers passed using a function module interface always contain persistent object references. Before you read object references from a container and store them in a variable, you must make all object references in the container into runtime references. To do this, execute the following macro instruction:

SWC_CONTAINER_TO_RUNTIME <Container>.

Example

You must process a container with this macro if you:

-         Read a rule container for rule resolution

-         Read an event container within a check function module or a receiver type function module

Procedure

...

       1.      Create a variable for the object reference. Use the following command to do this:

DATA <Object> TYPE SWC_OBJECT.

       2.      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_TYPEand SWC_GET_OBJECT_KEY. For more information, see Macro Instructions for Accessing Objects, Attributes and Methods

Note

If you only want to read one object reference, you should also only convert this object reference into a runtime reference for performance reasons. To do this, proceed as follows:

DATA <Object>   TYPE SWC_OBJECT
     <Variable> LIKE SWOTOBJID.
SWC_GET_ELEMENT <Container> <ContainerElement> <Variable>.
SWC_OBJECT_FROM_PERSISTENT <Variable> <Object>.

 

 

End of Content Area