Entering content frame

This graphic is explained in the accompanying text Assignment Between Structure and Single Field III Locate the document in its SAP Library structure

*-------------------------------------------------------------
* MOVE: structure <-> single field                            
*-------------------------------------------------------------

report ZCH_UNIEXP_8.

data: begin of STRUC,
         F1(3) type x,
         F2(8) type p,
      end of STRUC,

      CONTAINER(1000) type c.

* Before Unicode enabling:

* CONTAINER = STRUC. <---- Unicode error

* STRUC     = CONTAINER. <---- Unicode error

* After Unicode enabling
* if container is used as temporary transport container (no
* database, no RFC, no file, no offset access to parts of the
* container)

field-symbols: <X_CONTAINER> type x,
               <X_STRUC>     type x.

assign CONTAINER to <X_CONTAINER> casting.
assign STRUC     to <X_STRUC>     casting.

<X_CONTAINER> = <X_STRUC>.
<X_STRUC>     = <X_CONTAINER>.

* Or use service class cl_abap_container_utilities:

class CL_ABAP_CONTAINER_UTILITIES definition load.

call method CL_ABAP_CONTAINER_UTILITIES =>FILL_CONTAINER_C
  exporting  IM_VALUE               = STRUC
  importing  EX_CONTAINER           = CONTAINER
  exceptions ILLEGAL_PARAMETER_TYPE = 1
             others                 = 2.

call method cl_abap_container_utilities=>read_container_c
  exporting  IM_CONTAINER           = CONTAINER
  importing  EX_VALUE               = STRUC
  exceptions ILLEGAL_PARAMETER_TYPE = 1
             others                 = 2.

 

 

Leaving content frame