Anfang des Inhaltsbereichs

Diese Grafik wird im zugehörigen Text erklärt Zuweisung zwischen Struktur und Einzelfeld V Dokument im Navigationsbaum lokalisieren

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

report ZCH_UNIEXP_9.

* types: begin of T_VALUE_WA,
*          TABNAME(30)     type c,
*          DUMMY_ALIGN     type f,
*          CONTAINER(1000) type c,
*        end of T_VALUE_WA,
*        T_VALUE_LIST type table of T_VALUE_WA.

* data:  L_VALUES   type T_VALUE_LIST,
*        L_VALUE_WA type T_VALUE_WA,
*        L_D010SINF type D010SINF,
*        L_CO2MAP   type CO2MAP.

* L_VALUE_WA-TABNAME   = 'D010SINF'.
* L_D010SINF-DATALG    =  41.

* L_VALUE_WA-CONTAINER =  L_D010SINF.   <---- Unicode error

* append L_VALUE_WA to L_VALUES.

* L_VALUE_WA-TABNAME   = 'CO2MAP'.
* L_CO2MAP-ID          =  42.

* L_VALUE_WA-CONTAINER = L_CO2MAP.      <---- Unicode error

* append L_VALUE_WA to L_VALUES.

* Pass L_VALUES to processing routine ...

* Do something

* data: L_DFIES_TAB type table of DFIES.

* field-symbols: <DT>       type DFIES,
*                <VALUE_WA> type T_VALUE_WA,
*                <f>.

* clear L_VALUES_WA.
* loop at L_VALUES assigning <VALUE_WA>.

*   call function 'DDIF_NAMETAB_GET'
*    exporting
*      tabname = <VALUE_WA>-TABNAME
*    tables
*      DFIES_TAB = L_DFIES_TAB.

*   loop at L_DFIES_TAB assigning <DT>.
*     assign <VALUE_WA>-CONTAINER+<DT>-OFFSET(<DT>-INLEN)
*     to <F> type <DT>-INTTYPE.
*     write  <F>.
*   endloop.
* endloop.

* After using (Unicode enabled) new reference technique
* and EXPORT TO DATA BUFFER:

types: begin of T_VALUE_WA,
         TABNAME(30)     type c,
         XWA             type xstring,
         CONTAINER(1000) type c,
       end of T_VALUE_WA,

       T_VALUE_LIST type table of T_VALUE_WA.

data:  L_VALUES   type T_VALUE_LIST,
       L_VALUE_WA type T_VALUE_WA,
       L_D010SINF type D010SINF,
       L_CO2MAP   type CO2MAP.

L_D010SINF-DATALG  =  41.
L_VALUE_WA-TABNAME = 'D010SINF'.
export WA from L_D010SINF to data buffer L_VALUE_WA-XWA.
append L_VALUE_WA to L_VALUES.

L_CO2MAP-ID        =  42.
L_VALUE_WA-TABNAME = 'CO2MAP'.
export WA from L_CO2MAP to data buffer L_VALUE_WA-XWA.
append L_VALUE_WA to L_VALUES.

* Pass L_VALUE to processing routine ...
* Do something

data: DREF     type ref to data,
      L_NUMBER type i,
      L_TYPE   type c.

field-symbols: <WA>   type any,
               <COMP> type any.

clear L_VALUE_WA.

loop at L_VALUES into L_VALUE_WA.
  create data DREF type (L_VALUE_WA-TABNAME).
  assign DREF->* to <WA>.
  import WA to <WA> from data buffer L_VALUE_WA-XWA.
  describe field <WA> type L_TYPE components L_NUMBER.
  
  do L_NUMBER times.
    assign component SY-INDEX of structure <WA> to <COMP>.
    write <COMP>.
  enddo.
endloop.

Ende des Inhaltsbereichs