‎2008 Jun 30 2:02 PM
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 ...
‎2008 Jun 30 2:04 PM
FIELD-SYMBOLS: <fs_wa> TYPE ANY.
LOOP AT itab INTO wa.
ASSIGN wa TO <fs_wa> CASTING TYPE c.
ENDLOOP.Regards
Kannaiah
‎2008 Jun 30 2:07 PM
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
‎2008 Jun 30 2:09 PM
Hi......
convert decimal to char and proceed
Thanks.
Naveen.I
Edited by: Naveen Inuganti on Jun 30, 2008 6:39 PM
‎2008 Jun 30 2:15 PM
‎2008 Jun 30 2:21 PM
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:
‎2008 Jun 30 2:24 PM
‎2008 Jun 30 2:35 PM
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®
‎2008 Jun 30 2:41 PM
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,
‎2008 Jun 30 2:48 PM
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®
‎2008 Jun 30 2:54 PM
‎2008 Jun 30 3:44 PM
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.
‎2008 Jun 30 3:56 PM
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...
‎2008 Jun 30 4:41 PM
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
‎2008 Jun 30 4:48 PM
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,
‎2008 Jun 30 4:57 PM
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®
‎2008 Jun 30 5:06 PM
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
‎2008 Jun 30 5:43 PM
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
‎2008 Jun 30 5:55 PM
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....
‎2008 Jun 30 6:23 PM
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
‎2008 Jun 30 3:14 PM
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
‎2008 Jun 30 3:42 PM
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.