Application Development 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: 

reg Unicode: type convertion from byte and string charecter processing

Former Member
0 Kudos

Hi all,

I currently working on MM module where programs to be checked Unicode enabled in new versions 6.10 relase .

I have a problem in one of the program ..where the error is above mentioned type conversion is no longer possible.

the program :

LOOP AT pdf INTO wa_pdf.

TRANSLATE wa_pdf USING ' ~'.

CONCATENATE buffer wa_pdf INTO buffer.

ENDLOOP.

TRANSLATE buffer USING '~ '.

DO.

--> APPEND buffer TO t_pdf .error message

SHIFT buffer LEFT BY 255 PLACES.

IF buffer IS INITIAL.

EXIT.

ENDIF.

the fields are declared as

pdf TYPE STANDARD TABLE OF tline,

wa_pdf LIKE LINE OF pdf,

buffer TYPE string,

t_pdf TYPE STANDARD TABLE OF solix.

My question is how to make convertion using other logic.

any help is highly appreciated .

regards,

Amarnath Reddy

1 ACCEPTED SOLUTION

sridhar_k1
Active Contributor
0 Kudos

Try the following code:

Declare the following variables.

data: ls_pdf type solix,

ls_char(255) type c.

field-symbols: <fs> type any.

Add this code instead of 'append buffer to t_pdf in ur code:

ls_char = buffer.

assign ls_char to <fs> casting type x.

ls_pdf-line = <fs>.

append ls_pdf to t_pdf.

Regards

Sridhar

7 REPLIES 7

Former Member
0 Kudos

question is conversion of charecter string to byte string

processing

0 Kudos

REPORT ZSRIM_TEMP23.

DATA : PDF TYPE STANDARD TABLE OF TLINE,

WA_PDF LIKE LINE OF PDF,

BUFFER TYPE STRING,

T_PDF TYPE STANDARD TABLE OF SOLIX.

LOOP AT PDF INTO WA_PDF.

TRANSLATE WA_PDF USING ' ~'.

CONCATENATE BUFFER WA_PDF INTO BUFFER.

ENDLOOP.

TRANSLATE BUFFER USING '~ '.

DO.

*--> APPEND buffer TO t_pdf .error message

SHIFT BUFFER LEFT BY 255 PLACES.

IF BUFFER IS INITIAL.

EXIT.

ENDIF.

ENDDO.

I copied your code in my sap system,but i am not getting any ERROR.can you please give the Error description along with the code.

Regards

Srikanth

Former Member
0 Kudos

Hi Sridar,

error message was t_pdf and buffer are not mutually convertable in unicode as t_pdf is of type solix and solix contains raw data type of binary data which is of byte string and buffer is having a string which is character string.

I think there is a structure mismatch .

0 Kudos

use like,

FIELD-SYMBOLS: <cf> TYPE C.

ASSIGN BUFFER TO <cf> CASTING.

T_PDF = <CF>.

regards,

Srikanth.

0 Kudos

I guess in UNICODE enabled system, data transferring between structures is possible only when both the structures are same or both have only character format fields.

To avoid the error, i think we need to explicitly move field by field when the structure alters.

Kind Regards

Eswar

sridhar_k1
Active Contributor
0 Kudos

Try the following code:

Declare the following variables.

data: ls_pdf type solix,

ls_char(255) type c.

field-symbols: <fs> type any.

Add this code instead of 'append buffer to t_pdf in ur code:

ls_char = buffer.

assign ls_char to <fs> casting type x.

ls_pdf-line = <fs>.

append ls_pdf to t_pdf.

Regards

Sridhar

Former Member
0 Kudos

Hi all,

Thanks for the helping me in solving the problem.

regards,

Amarnath Reddy.