Skip to Content
-1

Unicode error: x and y are not mutually convertible in unicode program

Hi Experts,

I have declared as follows:

->DATA: BEGIN OF ACTIVITY,
RF_NUMBER LIKE ZUIHNVLB-RF_NUMBER,
SPACE1(3) TYPE C VALUE ' ',
CREATE_DT LIKE ZUIHNVLB-CREATE_DT,
SPACE2(3) TYPE C VALUE ' ',
CREATE_TM LIKE ZUIHNVLB-CREATE_TM,
SPACE3(3) TYPE C VALUE ' ',
ELPSD_TM LIKE ZUIHNVLB-ELPSD_TM,
SPACE4(3) TYPE C VALUE ' ',
CREATE_ID LIKE ZUIHNVLB-CREATE_ID,
CHANGE_ID LIKE ZUIHNVLB-CHANGE_ID,
END OF ACTIVITY.

->DATA: DESCRIPTION LIKE ZUWB01-WB_DESC.

->LOOP AT RF_TABLE.
ACTIVITY-RF_NUMBER = RF_TABLE-RF_NUMBER.
ACTIVITY-CREATE_DT = RF_TABLE-CREATE_DT.
ACTIVITY-CREATE_TM = RF_TABLE-CREATE_TM.
ACTIVITY-ELPSD_TM = RF_TABLE-ELPSD_TM.
ACTIVITY-CREATE_ID = RF_TABLE-CREATE_ID.
ACTIVITY-CHANGE_ID = RF_TABLE-CHANGE_ID.

MOVE ACTIVITY TO DESCRIPTION. ----->Here iam moving
MOVE RF_TABLE-RF_NUMBER TO KEYINFO.
MOVE ' ' TO DISPLAY_FM.
MOVE VB_OBEX TO EXECUTE_FM.
MOVE INDICATOR_ON TO CHANGE_FLAG.
MOVE INDICATOR_ON TO CREATE_FLAG.

INCLUDE ZUIN0138.
ADD 1 TO SEQ.
APPEND LEVEL_TABLE.
ENDLOOP.

ERROR: "Description" & "Activity" are not mutually convertible in Unicode program.

Please suggest what to do, a fast response would be appreciated.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

5 Answers

  • Best Answer
    Jan 23 at 08:50 AM

    "One field in ACTIVITY is a decimal type". Yeah - that's why you can't do a straight move. You need to get the decimals into a character format. For that use WRITE ... TO...

    Let's say that field is called "AMOUNT".

    Create a new structure, ACTIVITY_CHAR with the same field names as ACTIVITY, except for AMOUNT, which you call AMOUNT_CHAR (Type C length 17... or whatever).

    MOVE-CORRESPONDING activity TO activity_char.
    WRITE activity-amount TO activity_char-amount_char NO-GROUPING RIGHT-JUSTIFIED.
    description = activity_char.
    Add comment
    10|10000 characters needed characters exceeded

  • Jan 22 at 11:26 AM

    Welcome to Unicode world...

    • First check every field is correcly defined (no packed subfield to character subfield or so)
    • Then if some fields are not character type, look at online documentation on ASSIGN CASTING option (or use provided tools such as CL_ABAP_CONTAINER_UTILITIES, actually read the code of this class for some hints)
    Add comment
    10|10000 characters needed characters exceeded

  • Jan 22 at 02:38 PM

    If the structure contains non-character type field, it will lead to mutually unconvertible error in unicode system. You can use following code to move data from structure to string .

    CALL METHOD cl_abap_container_utilities=>fill_container_c
      EXPORTING
        im_value               = activity
      IMPORTING
        ex_container           = description
      EXCEPTIONS
        illegal_parameter_type = 1
        OTHERS                 = 2.
    
    
    
    Add comment
    10|10000 characters needed characters exceeded

    • Hi Monalisa,

      I tried your suggestion but the value in 'description' is not coming correct. The decimals value are coming like '#########'. Any suggestion on this like how can I get exact values from activity into description?

  • Jan 23 at 07:44 AM

    Unicode system dont accept that kind of move thats why you have error. Solution is depend on what you want to do.

    in your code, i see that you move data from a table to ACTIVITY structure which have all the fields as character type. If data in activity already correct,i think it quite simple by just CONCATENATE all the activity fields into description....

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 22 at 12:12 PM

    Hi Experts,

    I would like to mention that :

    ELPSD_TM LIKE ZUIHNVLB-ELPSD_TM,

    field in ACTIVITY is decimal type.

    While Description's field: ZUWB01-WB_DESC is char type.

    Add comment
    10|10000 characters needed characters exceeded