Writing an Object Reference into a Container 
Prerequisites
The following prerequisites must be fulfilled in order to write an object reference into a container:

These prerequisites are always fulfilled if you are in the
Procedure
DATA <Object> TYPE SWC_OBJECT.
SWC_CREATE_OBJECT <Object> <ObjectType> <ObjectKey>.
SWC_SET_ELEMENT <Container> <ContainerElement> <Object>.

Upper and lower case are not distinguished for the container element ID. If the container is used in the binding of a workflow, you must ensure that a container element of the same name is defined in the container definition.
SWC_CONTAINER_TO_PERSISTENT <Container>.

You need persistent object references if the container is also to be used in another program context. This applies if you pass the container as a parameter in a function call, for example if:
Result
The object reference created is a runtime reference that only exists in the environment of the creating program. This object reference is written into the container in a container element. If the container element with this ID is not yet in the container, it is inserted into the container with its value. If there is already a container element with this ID in the container, the old value is overwritten with the new value. If the container is needed in another program context, you must make the object references contained persistent.
Example
An object of the type
KNA1 (customer) is described as a key field via the customer number. The customer number is under KUNNR in the table KNA1 (customer master: general section).* Type declaration for key field
* Object: Customer
DATA KUNNR LIKE KNA1-KUNNR. "Customer number
A value is assigned to the field
KUNNR :* Customer number
KUNNR = '0000004711'.
The variable
CUSTOMER is declared as an object reference.* Type declarations for object
DATA CUSTOMER TYPE SWC_OBJECT.
An object reference is created for the object type
KNA1 (customer) mentioned above.* Create object reference for object type KNA1
SWC_CREATE_OBJECT CUSTOMER 'KNA1' KUNNR.
The customer is entered into the container
MY_CONTAINER in the container element Customer .* Write object reference into container
SWC_SET_ELEMENT MY_CONTAINER 'Customer' CUSTOMER.
The object references of the container are made persistent.
SWC_CONTAINER_TO_PERSISTENT MY_CONTAINER.