Skip to Content
author's profile photo Former Member
Former Member

Unicode problem: Converting operations on type X operands

I've got a problem converting a function module to unicode functionality: the original coding performs MOVE and SHIFT operations on operands of type X. The extended syntax check after unicode flag is set fails as X or XSTRING are not considered character-like anymore, of course, as these operations wouldn't delivery a stable result due to the variable lengths in UTF-8. Simply using type C, String or any other character-like operand type instead wouldn't help either, of course, because all bytestream information would be lost. Does anyone have recommandation on how I can solve this issue?

Thanks in advance!

Andy

Here's an example for the original coding (importhash = import parameter):

DATA: OP1(10) TYPE X,

...

SLEN TYPE I.

DATA: OP2(12) TYPE X,

...

DATA: T_OP2 TYPE SOMEINTEGER WITH HEADER LINE,

T_OP1 TYPE SOMEINTEGER WITH HEADER LINE,

...

OP1 = SOMECHARACTER.

SLEN = STRLEN( OP1 ) / 2.

MOVE SLEN TO THE_OP1.

APPEND THE_OP1.

DO SLEN TIMES.

MOVE OP1+0(1) TO T_OP1.

APPEND T_OP1.

SHIFT OP1.

ENDDO.

MOVE IMPORTHASH+0(2) TO SLEN.

MOVE SLEN TO T_OP2.

APPEND T_OP2.

OP2 = IMPORTHASH.

SHIFT OP2.

DO SLEN TIMES.

MOVE OP2+0(1) TO T_OP2.

APPEND T_OP2.

SHIFT OP2.

ENDDO.

....

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Nov 20, 2005 at 02:48 PM

    Hi,

    Especially for Unicodes, it is recommended to separate the Data declarations into a separate Type pool.

    DATA: OP1(10) TYPE X,

    ...

    SLEN TYPE I.

    DATA: OP2(12) TYPE X,

    Mark the type pool as unicode active. Then, use this type pool in your program.

    The class variables in CL_ABAP_CHAR_UTILITIES may also help you.

    Cheers,

    Bhanu

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Bhanu,

      thanks for the info, I found a solution myself now, which isn't really unicode-enabling, but "fools" the extended syntax check (actually no real problem here as there won't be any real unicode information handled with the function module anyway). Anyway thanks, I might use that info on other unicode issues for sure, as we haven't finished migrating yet.

      Cheers,

      Andy

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.