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 Type Conversion Error

Former Member
0 Likes
575

Hi Friend,

I am working in UNICODE project,i need one help,

I have one error .

Actually, im using one structure(Z0028) and passing values to internal table.

At that time i shows one error.

Actually,this error is due to type conversion problem.

In that structure,i ve one packed datatype ,so, if i select

unicode check it shows error.

I will sent example prg and error also.

Please give some solution to slove.

REPORT YPRG1 .

TABLES: Z0028.

DATA:I_Z0028 TYPE Z0028 OCCURS 0 WITH HEADER LINE .

SELECT * FROM Z0028 INTO TABLE I_Z0028 .

IF SY-SUBRC 0 .

WRITE:/ ' NO DATA'.

ENDIF.

LOOP AT I_Z0028.

WRITE:/ I_Z0028.

ENDLOOP.

Regards,

Kalidas.T

4 REPLIES 4
Read only

uwe_schieferstein
Active Contributor
0 Likes
550

Hello Kalidas

Here is a simple "smoke test". Try to see if the system accept the following statement:

" NOTE: Try to write the packed field only

WRITE: / i_z008-packed_field.

If you receive an error you cannot WRITE packed values directly.

Alternative solution: write your structure to a string.

DATA:

ls_z008 LIKE LINE OF i_z008,

ld_string TYPE string.

LOOP AT i_z008 INTO ls_z008.

CALL METHOD cl_abap_container_utilities=>fill_container_c

EXPORTING

im_value = ls_z008

IMPORTING

ex_container = ld_string.

WRITE: / ld_string.

ENDLOOP.

Regards

Uwe

Read only

Former Member
0 Likes
550

I dont see any type conversion in your code...

If in that code you are getting this error, you can try creating an internal table without using occurs 0. and create a work area of the same type as of internal table.

Data: it_z0028 type standard table of Z0028,

wa_z0028 type z0028.

Select * from Z0028 into table it_z0028.

Loop at it_z0028 into wa_z0028.

Write wa_z0028.

Endloop.

This should work...

Lokesh

Read only

former_member194669
Active Contributor
0 Likes
550

Try as per Uwe's suggestion

or

try


REPORT YPRG1 .
TABLES: Z0028.
DATA:I_Z0028 TYPE Z0028 OCCURS 0 WITH HEADER LINE .
SELECT * FROM Z0028 INTO TABLE I_Z0028 .

IF SY-SUBRC 0 .
WRITE:/ ' NO DATA'.
ENDIF.

LOOP AT I_Z0028.
WRITE:/ I_Z0028-MATNR.
WRITE: 20 I_Z0028-DESCR.
WRITE: 30 I_Z0028-QTY.

" .......... continue by field by field.

ENDLOOP.

a®

Read only

Former Member
0 Likes
550

Hi,

Refer to the following link below on conversion:

http://help.sap.com/saphelp_nw04/helpdata/en/79/c55473b3dc11d5993800508b6b8b11/content.htm

Best Regards,

Rajesh.