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

Unicode issue:

Former Member
0 Likes
1,848

Hello friends,

I am getting unicode non- convertiable error, actually I have an internal table of char and to this internal table I need to assign a structure which contains all fields as char except one field which is dec...

how I can fix this issue ?

regards,

I guess field-symbols could solve my problem but not so much sure ...

21 REPLIES 21
Read only

Former Member
0 Likes
1,804
FIELD-SYMBOLS: <fs_wa> TYPE ANY.

LOOP AT itab INTO wa.
  ASSIGN wa TO <fs_wa> CASTING TYPE c.
ENDLOOP.

Regards

Kannaiah

Read only

Former Member
0 Likes
1,804

Hi

go to se 38

select radio button Attributes

click OK

then disable the unicode check active

I think this ll work

Thanks & Regards

vinsee

Read only

naveen_inuganti2
Active Contributor
0 Likes
1,804

Hi......

convert decimal to char and proceed

Thanks.

Naveen.I

Edited by: Naveen Inuganti on Jun 30, 2008 6:39 PM

Read only

0 Likes
1,804

I did the following and now getting short dump:

FIELD-SYMBOLS: <fs_wa> TYPE ANY.

LOOP AT zidoc_post.

CLEAR: lt_raw_data.

ASSIGN zidoc_post TO <fs_wa> CASTING TYPE c.

lt_raw_data-line = <fs_wa>.

"lt_raw_data-line = zidoc_post.

APPEND lt_raw_data.

Runtime Error SYNTAX_ERROR is the shot dump:

Read only

0 Likes
1,804

hello Abdul, the links you have provided are not working ??

Read only

0 Likes
1,804

You need to use class cl_abap_container_utilities for this "type casting" will not work in unicode


LOOP AT zidoc_post.

CLEAR: lt_raw_data.

class cl_abap_container_utilities definition load.
call method cl_abap_container_utilities=>fill_container_c
     exporting
       im_value               = zidoc_post
     importing
       ex_container           = lt_raw_data-line
     exceptions
       illegal_parameter_type = 1
       others                 = 2.

APPEND lt_raw_data.

a®

Read only

0 Likes
1,804

Hello,

I have tried the class utilities way, and again got the same shot dump.

Error analysis

The following syntax error was found in the program /XYZ :

""LT_ZIDOC_POST" and "PT_RAW_DATA-LINE" are not mutually convertible in"

Regards,

Read only

0 Likes
1,804

Whether your PT_RAW_DATA-LINE is a character type variable.

if not declare a character variable

data : VLINE(1000) TYPE C.and use in place of PT_RAW_DATA-LINE

a®

Read only

0 Likes
1,804

Line is type LCHR .....

Read only

0 Likes
1,804

fields in both tables shud hav same data type.plz check.

The internal table you are using shud hav the same order of fields as it is in data base. The internal table cant hav less no of fields from data base..

Check all this. ur problem will be solved.

Read only

0 Likes
1,804

As I said, I am haing one table which has all char field apart of one field which is dec...now I need to assign this table as following:

lt_raw_data-line = zidoc_post.

So Zidoc_post is the table I am getting need to assign to lt_raw_data-line . where as line is the field of type Lchar 5000 .

when I make all fields in zidoc_post char things work fine, but there one field is now price which is DEC....

So thats why I am getting unicode non-convertaible issue...

Read only

0 Likes
1,804

Hi,

as I posted above - you have to move that component by component. One single move for the whole structure is strictly forbidden even if only one field is numerical.

kind regards,

HP

Read only

0 Likes
1,804

Hi holger,

I did not understand what do you mean by component to component, I have only having 1 field in the target str.

Regards,

Read only

0 Likes
1,804

Try to be simple.

Create another workarea (type) as same as zidoc_post and make it all fields are character.


LOOP AT zidoc_post.
  move fields by field to type (ie new type (work area)
  and only for DEC field
  write  zidoc_post-<decimal field> to type-character field of decimal
  move type-< new structure> to lt_raw_data.
  APPEND lt_raw_data.

a®

Read only

0 Likes
1,804

Hi, your suggstin could work: but then I need to change both str, if I extend the one, anyway i will give it a try, if it temp. solve me issue..... but I was more looking for Uni-code solution.... might be a keyword or they way you provided / suggest with class ??

I will be back after tring you suggestion anyway

Read only

0 Likes
1,804

Hi,

a®s got the point. Unfortunately there is no shortcut. Only field symbols may help a bit (ASSIGN COMPONENT OF STRUCTURE).

kind regards,

HP

Read only

0 Likes
1,804

hi friends,

okay, this way I can do one by one field to the target str which contains only line....

but now I am facing vice-versa problem ( to be honest this coading sucks and I need to maintain the code

LOOP AT pt_raw_data.

lt_zidoc_post = pt_raw_data-line.

endloop.

So now its from line str to the zidoc_post....

Read only

0 Likes
1,804

Hi,

maybe this helps a bit - outbound is similar. Be carefull with user settings. Must be identically in- and outbound!

And if you can read conversion exits fromm DDIC you should do it at inbound procedure.


FORM map_idocline_2_struct CHANGING....
....



FIELD-SYMBOLS: <comp_in> TYPE ANY,  <comp_out> TYPE ANY.

...

DO.

  ASSIGN COMPONENT sy-tabix of STRUCTURE my_input1 TO <comp_in>. 
  IF sy-subrc <> 0.
    EXIT. 
  ENDIF.
  ASSIGN COMPONENT sy-tabix of STRUCTURE my_input2 TO <comp_out>. 
  CHECK sy-subrc = 0.
  DESCRIBE FIELD <comp> TYPE lv_fieldtype.
  CASE lv_fieldtype.
    WHEN 'P' or 'I' or 'F' or 'D'. 
      WRITE <comp_in> TO <comp_out>.
    WHEN others.
      MOVE <comp_in> TO <comp_out>.
  ENDCASE.
ENDDO.

Kind regards,

HP

Edited by: Holger Pakirnus on Jun 30, 2008 7:24 PM

Edited by: Holger Pakirnus on Jun 30, 2008 7:28 PM

Read only

Former Member
0 Likes
1,804

Hi,

since unicode there is no solution for this (for good reasons - aligment would be a real problem for most code pages).

Required procedure:

1) define a structure containing character fields only

2) Move your IDOC data to this structure

3) Call a mapping routine moving each component of the new structure to the final target structure (doing all neccessary conversions).

New structure and target structure may have the same component names - this makes dynamic programming a bit easier....

Kind regards,

HP

Read only

0 Likes
1,804

I am trying something like this: but still did not work as expected:

data : VLINE(5000) TYPE C.

LOOP AT zidoc_post.

CLEAR: lt_raw_data.

  • ASSIGN zidoc_post TO <fs_wa> CASTING TYPE c.

  • lt_raw_data-line = <fs_wa>.

  • "lt_raw_data-line = zidoc_post.

CALL METHOD cl_abap_container_utilities=>fill_container_c

EXPORTING

im_value = zidoc_post

IMPORTING

ex_container = VLINE

EXCEPTIONS

illegal_parameter_type = 1

OTHERS = 2.

move VLINE to lt_raw_data-line.

APPEND lt_raw_data.

ENDLOOP.

Please note in zidc_post there is only one field which id dec, remaing all fields are tpye c.