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

Convert EXCEL Minus to String , hex mode Question

Former Member
0 Likes
944

Hello everybody,

I am uploading an excel.

There is a cell value = 1.1.14–31.3.14.

If you type in <1.1.14–31.3.14> manually  hex mode for this is:

0031002E0031002E00310034  002D  00330031002E0033002E00310034

But when uploading from excel it is:

0031002E0031002E00310034  2013  00330031002E0033002E00310034

When I try to split <1.1.14–31.3.14>  on the minus,

than

data: delim(1) value '-'.
            split DATUMSTRING at delim into von_str bis_str.



works OK.


But how can I define the delimiter for the EXCEL split.

I tried:


DATA : hex_minus TYPE x .
       hex_minus = '2013'.
       delim = hex_minus.



But this does not work.


Regards

Mario



1 ACCEPTED SOLUTION
Read only

nabheetscn
SAP Champion
SAP Champion
0 Likes
818

Hi Mario

Are you using some FM to upload the file. From where does this Hex thing comes up?

Nabheet

Hello everybody,

I am uploading an excel.

There is a cell value = 1.1.14–31.3.14.

If you type in <1.1.14–31.3.14> manually  hex mode for this is:

0031002E0031002E00310034  002D  00330031002E0033002E00310034

But when uploading from excel it is:

0031002E0031002E00310034  2013  00330031002E0033002E00310034

When I try to split <1.1.14–31.3.14>  on the minus,

than

data: delim(1) value '-'.
            split DATUMSTRING at delim into von_str bis_str.



works OK.


But how can I define the delimiter for the EXCEL split.

I tried:


DATA : hex_minus TYPE x .
       hex_minus = '2013'.
       delim = hex_minus.



But this does not work.


Regards

Mario



4 REPLIES 4
Read only

nabheetscn
SAP Champion
SAP Champion
0 Likes
819

Hi Mario

Are you using some FM to upload the file. From where does this Hex thing comes up?

Nabheet

Read only

0 Likes
818

Hi nabheet,

I am using the SAP Officeintegration package.

regards

Mario

Read only

0 Likes
818

Hi everybody,

fyi there are two different minus  in ASCII

See:

ASCII-Tabelle

I created the fitting ASCII via ALT+0150

Thx, Regards

Mario

Read only

0 Likes
818

FYI.

The technical name for ALT+0150 character is En Dash.

Actual minus character is part of regular ASCII set, named as Hyphen.

The extended ASCII set has 2 similar characters named En Dash and Em Dash.

ABAP way of using hex value (unicode codepoint) would be like this.

  1. DATA a TYPE string VALUE '12345-–54321'.
  2. DATA b TYPE x LENGTH 2.
  3. DATA c TYPE string.
  4. b = '2013'.
  5. TRY.
  6.     c = cl_abap_conv_in_ce=>uccp( b ).
  7.   CATCH cx_sy_conversion_codepage .
  8.   CATCH cx_parameter_invalid_type .
  9.   CATCH cx_sy_codepage_converter_init .
  10. ENDTRY.
  11. FIND c IN a.
  12. BREAK-POINT.

Instead of creating hex variable, '2013' can be directly passed to class method too.

//

Message was edited by: Manish Kumar