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: 

Split/concatenate with a delimiter within Unicode

MichiFr
Participant
0 Kudos

Hi,

I've got the following coding in a Non-Unicode system which should be converted to a Unicode compatible coding:


DATA: delimiter(1) TYPE x VALUE '02'.
CONCATENATE anz_pos l_zaehler INTO text-line SEPARATED BY delimiter.
...
 SPLIT l_object_content-line AT delimiter INTO l_object l_adress.

Transaction UCCHECK complaints about the line CONCATENATE and SPLIT.

So what's the best way to retain the Hex value of '02' (this is requirement since there are old files archived, containing this delimiter, and which are still be processed) and split or concatenate the field values in an Unicode enabled Abap?

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Try this ..

DATA: l_lowval(5) TYPE c .                   
 DATA: c_lowval(5) TYPE c value '\X\02' .        ---> Hexadecimal

" Convert hexadecimal value to char
    CALL FUNCTION 'STPU1_HEX_TO_CHAR'
      EXPORTING
                hex_string        = c_lowval
     IMPORTING
              CHAR_STRING       = l_lowval.
DATA: delimiter(1) TYPE C.
delimiter =  l_lowval.

CONCATENATE anz_pos l_zaehler INTO text-line SEPARATED BY delimiter.
...
 SPLIT l_object_content-line AT delimiter INTO l_object l_adress.

5 REPLIES 5

rainer_hbenthal
Active Contributor
0 Kudos

>

> Hi,

> I've got the following coding in a Non-Unicode system which should be converted to a Unicode compatible coding:

>

>


> DATA: delimiter(1) TYPE x VALUE '02'.
> CONCATENATE anz_pos l_zaehler INTO text-line SEPARATED BY delimiter.
> ...
>  SPLIT l_object_content-line AT delimiter INTO l_object l_adress.
> 

>

> Transaction UCCHECK complaints about the line CONCATENATE and SPLIT.

>

> So what's the best way to retain the Hex value of '02' (this is requirement since there are old files archived, containing this delimiter, and which are still be processed) and split or concatenate the field values in an Unicode enabled Abap?

try


DATA: xdelimiter(1) TYPE x VALUE '02'.

field-symbols:
  <cdel> type c length 1.

assign xdelimiter to <cdel> casting.

After that use <cdel> instead of delimiter.

0 Kudos

Rainer,

unfortunately the syntax check complaints about the word 'length 1' in the FIELD-SYMBOLS declaration.

former_member242255
Active Contributor
0 Kudos

try the belwo FM..

CACS_CONVERT_HEX_TO_STRING - this should serve the purpose

NLS_STRING_CONVERT_TO_SYS

STPU1_HEX_TO_CHAR

Former Member
0 Kudos

Hi,

Try this ..

DATA: l_lowval(5) TYPE c .                   
 DATA: c_lowval(5) TYPE c value '\X\02' .        ---> Hexadecimal

" Convert hexadecimal value to char
    CALL FUNCTION 'STPU1_HEX_TO_CHAR'
      EXPORTING
                hex_string        = c_lowval
     IMPORTING
              CHAR_STRING       = l_lowval.
DATA: delimiter(1) TYPE C.
delimiter =  l_lowval.

CONCATENATE anz_pos l_zaehler INTO text-line SEPARATED BY delimiter.
...
 SPLIT l_object_content-line AT delimiter INTO l_object l_adress.

Former Member
0 Kudos

This, for when it would be a tab

*CONSTANTS: c_delimeter TYPE x VALUE '09'. "<TAB>

CONSTANTS: c_delimeter VALUE cl_abap_char_utilities=>horizontal_tab.

SPLIT yourfield at c_delimeter INTO v_result.