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: 

ASCII value

former_member534411
Participant
0 Kudos

Guys:

This is might be not SAP related!!!

What is Ascii charter for 23 in Microsoft Excel since i am sending excel sheet to uploading data into SAP. SAP standard program spliting data based on the 23 Ascii value so i will also separate my excel file by 23 Ascii char.

Thanks in advance

Suresh Babu Karanam

13 REPLIES 13

Former Member
0 Kudos

Hi Suresh,

ASCII 23 = ETB (Hex = 17) (Char = ^W)

Meaning = End transmission block, not the same as EOT

You might take a look at site:

http://www.robelle.com/library/smugbook/ascii.html

Regards,

Rob.

former_member534411
Participant
0 Kudos

Guys:

My requirment is i have one,two and three variables. i need to concatenate and <b>separeted char 23 is ASCII value</b>.

one = my.

two = sap.

CONCATENATE one two INTO three

<b>SEPARATED BY (ASCII 23)</b>

How can i go about that above issue. If any body have idea please share with me.

Advanced Thanks

Suresh Babu Karanam

christian_wohlfahrt
Active Contributor
0 Kudos

Hi Suresh,

there is a work-around with structures:

DATA: BEGIN OF ascii23_struc,

field TYPE x,

END OF ascii23_struc,

ascii23 TYPE char1.

ascii23_struc-field = 23.

MOVE ascii23_struc TO ascii23.

Unfortunately it's not longer supported with unicode.

I didn't find 23 somewhere in SAP, but for some other characters following is available (in 4.7):

ascii23 = cl_abap_char_utilities=>horizontal_tab.

In older version an include or type-pool for some general definitions should be available.

Regards,

Christian

Former Member
0 Kudos

Hi Suresh,

You can easily concatenate using a ASCII value and also split the concatenated string at ASCII value.

Check the below code,

DATA: temp_hexa TYPE x VALUE 23,

one(10) TYPE c,

two(10) TYPE c,

three(20) TYPE c,

i_itab TYPE TABLE OF string,

w_itab like line of i_itab.

one = 'My'.

two = 'SAP'.

  • Concatenation of the strings using ascii 23

CONCATENATE one temp_hexa two INTO three.

WRITE:/ 'one :',one,' two :',two.

WRITE:/'three :',three.

  • Slpitting the strings at ascii 23

SPLIT three AT temp_hexa INTO TABLE i_itab.

LOOP AT i_itab into w_itab.

WRITE:/ w_itab.

ENDLOOP.

But when the concatenated string is print it will show the ASCII as # (i don't know why).

Hope that is helpful to you.

Regards,

Kathirvel.

0 Kudos

Interesting you say that,

<i>

But when the concatenated string is print it will show the ASCII as # (i don't know why). </i>

data : temp_hexa TYPE x VALUE 23

temp_hexa has a hexadecimal type. So the value assigned would be hexadecimal and therefore 23 would actually be 3 + 16 * 2 = 35 and ASCII for 35 is #

So you should use value as 17.

Regards,

Subramanian V.

P.S. - Nevertheless it is a novel way

Message was edited by: Subramanian Venkateswaran

Former Member
0 Kudos

Hi Subu,

You assign any ascii value to a hexa decimal type variable (say the temp_hexa), and print it on a list, i tried '09' for tab, '44' for ,(comma), but in the list it was only #.

If you could really solve this out for me it will be really nice.

Please try this and tell me the results.

Thanks in advance.

Kathirvel.

former_member534411
Participant
0 Kudos

Christian:

Thank you very much for usefull information. If po'ble 09 ASCII value charecter will also solve my purpose.

Regards

Suresh Babu Karanam

Former Member
0 Kudos

Hi Suresh,

If you got some answers please share them, it will be help for us.

Regards,

Kathirvel.

former_member534411
Participant
0 Kudos

Hi Guys:

please test the following code in the debugging mode you can identify for <b>same char(#)</b> have different <b>hexa decimal</b> values.

code

-


data : gd_separator type c.

data : test type c value '#'.

gd_separator = cl_abap_char_utilities=>horizontal_tab.

Once again thanks for all your help.

Regards

Suresh Babu Karanam

christian_wohlfahrt
Active Contributor
0 Kudos

Hi,

some more comments:

data temp type x value 23 "23 is entered as decimal, so this was correct (not 17)

When printing or debugging, we are all using SAP's list processor - and there are some restrictions to "printable characters": that's why most times just # as replacement is displayed. This doesn't occur in file download, but would be visible by using AL11 for displaying the file - just use a local editor for checking (the existence of tabulator for example).

If tabbed file is enough, two ways are handy: using a structure

TYPES: BEGIN OF types_line,

one TYPE mara-matnr,

sep01 TYPE c,

three TYPE kna1-kunnr,

sep02 TYPE c,

...

end of types_line.

...

start-of-selection.

CLASS cl_abap_char_utilities DEFINITION LOAD.

wa_line-sep01 = cl_abap_char_utilities=>horizontal_tab.

*( or old-style like mentioned above)

MOVE wa_line-sep01 TO: wa_line-sep02, ...

...

Or you use concatenate ... separated by sep...

which will lead to different results, when your fields contain spaces - shouldn't bother with Excel.

Regards,

Christian

0 Kudos

Thanks Christian for sharing that piece of information.

Just to confirm your statement, I wrote this piece of code, and the difference is in the quotes. Something new to learn every day, I guess.


data: hexa1 type x value '23'.
data: hexa2 type x value 23.
data: character type c.

if hexa1 eq hexa2.
  write 'Equals'.
else.
  write 'Does not equal'.
endif.

And hexcode 23 translating to 35 in decimal and exactly matching with the '#' code is just too much of a coincidence , I guess, for my theory.

Thanks again.

Regards,

Subramanian V.

Former Member
0 Kudos

Thanks Suresh and Christian,

I have something more to add, some time back i got stuck in a same kind of problem; i found some results, they are

1. If we want to use some separators mainly ASCII, they must be declared as hexa decimal values in most cases.

2. The above is much applicable when we want to split a string that has been concatenated using an ASCII value.

3. When such a string is concatenated and printed it will not display most of the ASCII values like (TAB - 09, ETB - 23, etc) instead it will display a # value only (but the hexa value will correspond to the actual ASCII value if debugged).

4. But when the same concatenated value is downloaded into a file the assigned ASCII value can be found.

Thus like Christian told these may be due to restrictions to "Printable Characters".

Once again Thanks to you all,

Regards,

Kathirvel.

former_member534411
Participant
0 Kudos

Christian Thanks for you information i got solution to my probelm. Since 4 days i trying to figure out .

Regards

Suresh Babu Karanam