Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Data objects in Unicode programs cannot be converted

Former Member
0 Likes
16,180

Hi all,

Could someone let me know what I am getting this error. How could I solve it? Any ideas are highly appreciated.


Short text                                                  
    Data objects in Unicode programs cannot be converted.   


Error analysis                                                              
    The statement                                                           
       "MOVE src TO dst"                                                    
    requires that the operands "dst" and "src" are convertible.             
    Since this statement is in a Unicode program, the special conversion    
    rules for Unicode programs apply.                                       
    In this case, these rules were violated.                                


  data: ld_struct     type ref to data.
  data: lv_fieldname  type        ztcbi_chkeymap-fromfld.
  data: lv_tabname    type        TABNAME.
  data: lv_tabkey     type        CDTABKEY.
  data: lv_bnfpo      type        BNFPO.

  field-symbols: <lf_stru>  type any,
                 <lf_field> type any.

  lv_tabname = 'EBKN'.
  lv_tabkey = '1000010000041000201'.
  lv_fieldname = 'BNFPO'.

  create data ld_struct type (lv_tabname).
  assign ld_struct->* to <lf_stru>.
  <lf_stru> = lv_tabkey.

  assign component lv_fieldname of structure <lf_stru> to <lf_field>.

  if sy-subrc = 0.
    lv_bnfpo = <lf_field>.
  else.
   lv_bnfpo = 0.
  endif.

  WRITE:/ lv_bnfpo.

1 ACCEPTED SOLUTION
Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
6,718

Hello,

This is because you're trying to move a data of TYPE CDTABKEY(CHAR70) to a structure TYPE EKBN. Try to change the data declaration as follows & the code should work:

DATA: lv_fieldname  TYPE        fieldname.
DATA: lv_tabkey     TYPE        ebkn.

You can read more about the data conversion rules in UC environment on F1 help.

BR,

Suhas

7 REPLIES 7
Read only

Former Member
0 Likes
6,718

Hi Mr. Wong,

Hopefully you you have to point both "src & dst" to one type of Fileld/Domain.

Please check that once.

Thanks & regards,

Dileep Kumar .C

Read only

0 Likes
6,718

Hi thanks for replying. I still do not understand and what to be changed.

Please help.

Read only

0 Likes
6,718

What is the data type for ztcbi_chkeymap-fromfld ?

Read only

Former Member
0 Likes
6,718

Hi

I have checked you code its perfect.

Just check one point

what is type and length of

data: lv_fieldname type ztcbi_chkeymap-fromfld.

It shoul be character and greater than 6.

Thanks

Dhiraj.

Read only

0 Likes
6,718

FROMFLD	Z_CHFRFLD	CHAR	30
CREDATE	CREATEDATE	DATS	8
CRETIME	CREATETIME	TIMS	6
CHGDATE	CHANGDATE	DATS	8
CHGTIME	CHANGTIME	TIMS	6
Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
6,719

Hello,

This is because you're trying to move a data of TYPE CDTABKEY(CHAR70) to a structure TYPE EKBN. Try to change the data declaration as follows & the code should work:

DATA: lv_fieldname  TYPE        fieldname.
DATA: lv_tabkey     TYPE        ebkn.

You can read more about the data conversion rules in UC environment on F1 help.

BR,

Suhas

Read only

Former Member
0 Likes
6,718

Thanks alot Suhas, it is working perfectly now.