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

split command

Former Member
0 Likes
955

Hi

the <b>split command</b> is not recognizing <b>'#'</b> character.

12 REPLIES 12
Read only

Former Member
0 Likes
901

Check the below code:

DATA: ws_data TYPE char10,

ws_data1 TYPE char5,

ws_data2 TYPE char5.

ws_data = 'Prak#ash'.

SPLIT ws_data AT '#' INTO ws_data1 ws_data2.

WRITE: / ws_data1.

WRITE: / ws_data2.

Regards,

Prakash.

Read only

Former Member
0 Likes
901

The hash is nothing but a 'tab' character.

trty using CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB instead of #.

split v_str into field1 field2 at CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.

Regards,

Ravi

Read only

0 Likes
901

I am new to object oriented concept, i have used

<b>CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB </b> as suggested by u. but while syntactical check it is showing <b>class is unknown</b>.

Any help in this regrads is greatly appreciated.

Read only

0 Likes
901

Hi Vijay,

1) Use statement CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB instead of '#' in your SPLIT statement.

2) Use CLASS CL_ABAP_CHAR_UTILITIES DEFINITION LOAD as the first statement in your report.

Thanks,

Vinay

Read only

0 Likes
901

Check if the following helps:

DATA : l_string TYPE string VALUE 'abcd#efgh#ijkl#mnop',

lt_string TYPE TABLE OF string.

SPLIT l_oth_string AT '#' INTO TABLE lt_string.

hith

Sunil Achyut

Read only

0 Likes
901

Hi

You need not declare the class. Try using as below.

<b>data: l_tab(1) type c value CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.</b>

split l_text at l_tab into l_text1 l_text2.

Kind Regards

Eswar

Read only

0 Likes
901

Hi Vinay,

i had used all the statements as suggested by u, but when activating it is giving the following message.

the type 'CL_ABAP_CHAR_UTILITIES' is unknown.

Read only

0 Likes
901

Hi Vijayarama,

Which version are you working on?

If you are on <4.7, then you have to use

data: v_tab type x value '09'.

split v_str into val1 val2 at v_tab.

REgards,

Ravi

Read only

Former Member
0 Likes
901

its working for me.check this code.

REPORT ZSRIM_TEMP14.

data : v1 type string,

v2 type string,

v3 type string,

v4 type string.

v1 = 'abcd#def#ghi'.

split v1 at '#' into v2 v3 v4.

write 😕 v1,v2,v3,v4.

but remember that if you are downloding data from application server and if the file has any seperator like (horizantal tab,or any special character) will be displayed for us as #.but internally it will be treated differently. so first confirm whether its a special character # or any other seperator ??

if you are in a unicode system, use

CL_ABAP_CHAR_UTILITIES=>HORIZANTAL_TAB for horizantal tab seperator

or use

data : v_htab type x value '09'. in a non unicode system.

Message was edited by: Srikanth Kidambi

Message was edited by: Srikanth Kidambi

Read only

Former Member
0 Likes
901

this is working fine in my system

REPORT ZSPELL.

DATA : CHA(10) VALUE 'ch#an',
       VAR1(5),
       VAR2(5).

SPLIT CHA AT '#' INTO VAR1 VAR2.

WRITE : VAR1 , VAR2.

Read only

former_member632991
Active Contributor
0 Likes
901

Hi,

Split command recognises this character.

if you write split 'abc#efg' at '#' into string1 string2.

it is working.

can you elaborate ur problem or write some code where r you facing the problem.

Regards,

Sonika

Read only

0 Likes
901

Hi,

The <b>'#'</b> symbol is special character, when i am converting the file from excel to <b>tab-delimited</b> some special characters are being introduced by sytem where ever there is a <b>enter or space</b>.

This special characters in SAP r shown as '#' and this r not recongnized by <b>split command</b>.

please help me in this regard.