‎2006 Nov 11 8:22 AM
I need to do conversation between data, stored in large char variable, and structure, that consists not only from char fields. In non-Unicode system "MOVE charstring TO structure" worked fine, but now this way isn't possible.
How can change the code to make it compatible with unicode?
‎2006 Nov 11 9:07 AM
Hi Aleksandr
I know it is pain taking but the way to go is explicitly moving to each field separately.
Eg:
move: charstring+0(18) to struc-matnr,
charstring+18(4) to struc-werks
------Kind Regards
Eswar
‎2006 Nov 11 3:41 PM
Hello Aleksandr
A more dynamic approach is demonstrated in the following sample coding:
DATA:
ls_struc TYPE <your table/structure>,
lt_dfies TYPE ddfields,
ls_dfies TYPE dfies.
FIELD-SYMBOLS:
<ld_fld> TYPE any.
CALL FUNCTION 'DDIF_FIELDINFO_GET'
EXPORTING
tabname = <name of table/structure>
TABLES
DFIES_TAB = lt_dfies
EXCEPTIONS
NOT_FOUND = 1
INTERNAL_ERROR = 2
OTHERS = 3.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT lt_dfies INTO ls_dfies.
ASSIGN COMPONENT (ls_dfies-fieldname) OF STRUCTURE ls_struc TO <ld_fld>.
<ld_fld> = ld_string+ls_dfies-offset(ls_dfies-intlen).
ENDLOOP.This works fine for all character-based fields. However, I have not found yet an elegant solution if the field has <b>INTTYPE = 'P'</b> (e.g. QUAN or DEC fields) because there can be a difference in length between INTLEN and OUTPUTLEN.
Regards
Uwe
‎2006 Nov 13 7:16 AM
But the problem is to do conversation exactly to the structure,that consists not only from char fields.
‎2006 Nov 13 7:26 AM
Hi Aleksandr
Please try as below:
1. Use FM: GET_COMPONENT_LIST to extract the structure definition. This FM will give us the details of the fields and their lengths.
2. Using the above info, we know where exactly we need to split the string to each individual field of the structure.
So by the above method, we can dynamically pass the data of the string to respective fields of the structure without going through more pain.
Hope this helps.
Kind Regards
Eswar