Skip to Content
0
Former Member
Nov 21, 2013 at 09:23 AM

[ABAP] How to move a REF DATA Structure to an iStructure-field

807 Views

Hi Everybody,

I have some difficult to move a REF DATA (structure) in a structure-FIELD.

In short : MOVE fo_generic to my structure-sdata.

Here, my code:

DATA fs_segment TYPE edi_dd40.

DATA fo_generic TYPE REF data ." Content a data structure type edi4sdata

CREATE DATA fo_generic TYPE (lv_type) . " lv_type = EDI4SDATA.

"... insert data in fo_generic

MOVE fo_generic TO fs_segment-sdata.

FO_GENERIC contents:

But I can not compiled the code for this reason:

" The type of FO_GENERIC cannot be converted to the type of "FS_SEGMENT-DATA"

Actually, the MOVE is working well when the type of fo_generic is declared explicitely as EDI4SDATA. But I would like something more generic with using:

DATA fo_generic TYPE REF data " Content a data structure type edi4sdata

CREATE DATA fo_generic TYPE (lv_type) . " lv_type = EDI4SDATA.

May you help?

Many thx.

Rachid.

Attachments

REF DATA.jpg (47.5 kB)