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

Hex Value using CL_ABAP_CHAR_UTILITIES

former_member194669
Active Contributor
0 Likes
2,540

All,

I need to concatenate 2 string that needs to be separated by hex value 1D

For example

string1 = 'Test'

String2 = 'Test2'


data: x_1D type x value '1D'.
concatenate string1 x_1d string2 into lv_text.

But this giving error

I need to concatenate string1 string2 with Hex value of 1D ( Group Separator)

How we can do this using CL_ABAP_CHAR_UTILITIES to group separator

1 ACCEPTED SOLUTION
Read only

naimesh_patel
Active Contributor
0 Likes
1,866

You can try something like this:


DATA: string1 TYPE string,
      string2 TYPE string,
      lv_text TYPE string.

string1 = 'Test'.
string2 = 'Test2'.

DATA: x_1d TYPE x VALUE '1D'.

DATA: lo_conv TYPE REF TO cl_abap_conv_in_ce.
lo_conv = cl_abap_conv_in_ce=>create( ).
DATA: string_1d TYPE string.
CALL METHOD lo_conv->convert
  EXPORTING
    input = x_1d
  IMPORTING
    data  = string_1d.

CONCATENATE string1 string_1d string2 INTO lv_text.

WRITE: lv_text.

Regards,

Naimesh Patel

All,

I need to concatenate 2 string that needs to be separated by hex value 1D

For example

string1 = 'Test'

String2 = 'Test2'


data: x_1D type x value '1D'.
concatenate string1 x_1d string2 into lv_text.

But this giving error

I need to concatenate string1 string2 with Hex value of 1D ( Group Separator)

How we can do this using CL_ABAP_CHAR_UTILITIES to group separator

7 REPLIES 7
Read only

Former Member
0 Likes
1,866

What error do you get?

I get no error when I execute your code.

Rob

Read only

0 Likes
1,866

This my code



report ZaRs.
data: lv_text(100) type c.
data: string1(10) type c value 'Test'.
data: string2(10) type c value 'Test2'.
data: x_1D type x value '1D'.
concatenate string1 x_1d string2 into lv_text.

Error will be while activating the program

X_1d must be character-like data object ( data C, N, D, T or STRING )

Read only

0 Likes
1,866

I still have no problem running your code. Are you in a Unicode environment?

Rob

Read only

0 Likes
1,866

Yes I am in Unicode

Read only

0 Likes
1,866

Hello all,

I know it's answered, but usually the solution is :


DATA c1.
c1 = CL_ABAP_CONV_IN_CE=>UCCP( '001D' ).

(as given in consulting note 540583 "How do I include country-specific characters in a program?)

BR

Sandra

Read only

naimesh_patel
Active Contributor
0 Likes
1,867

You can try something like this:


DATA: string1 TYPE string,
      string2 TYPE string,
      lv_text TYPE string.

string1 = 'Test'.
string2 = 'Test2'.

DATA: x_1d TYPE x VALUE '1D'.

DATA: lo_conv TYPE REF TO cl_abap_conv_in_ce.
lo_conv = cl_abap_conv_in_ce=>create( ).
DATA: string_1d TYPE string.
CALL METHOD lo_conv->convert
  EXPORTING
    input = x_1d
  IMPORTING
    data  = string_1d.

CONCATENATE string1 string_1d string2 INTO lv_text.

WRITE: lv_text.

Regards,

Naimesh Patel

Read only

0 Likes
1,866

Naimesh,

This is the answer i am expected..

Thankyou very much.

Solved.