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: 

Need to replace # getting from file

Former Member
0 Kudos

Hi All,

I am taking data from inbound file, and at the end of file i am getting a symbol #. Tried to replace this but its not allowing actually this is enter value. Can any one help us to resolve this.

Thanks,

Srinath

16 REPLIES 16

former_member209217
Active Contributor
0 Kudos

Hi Srinath,

Please let us know the logic you are using to replace it?

Have you tried using the CL_ABAP_CHAR_UTILITIES=>NEWLINE attribute.If not please check with this.

Regards,

Lakshman.

0 Kudos

Hi Lakshman,

I tried your thing yesterday itself but I couldnt get it right

I did replace CL_ABAP_CHAR_UTILITIES=>NEWLINE in wa_line with ' ' .

also replace '#' in ......

presently i have a solution but its not the best

I have a senario were i have to split this owrk area in to seperate fields

I am removing this # by using shift operator and its working fine, but I want to make it better

any other options.

Kind Regards,

Srinath.

Edited by: Srinath Ustili on Jul 6, 2010 8:48 AM

0 Kudos

In runtime ABAP compiler recognizes # as tab delimiter.

You try below code:

DATA: l_sep1 TYPE c.

l_sep1 = cl_abap_char_utilities=>HORIZONTAL_TAB.

replace all occurances of l_sep1 in wa_it with space.

or

DATA: l_sep1 TYPE c.

l_sep1 = cl_abap_char_utilities=>HORIZONTAL_TAB.

SPLIT wa_it AT l_sep1 INTO wa_string-string1 wa_string-string2 wa_string-string3 wa_string-string4

wa_string-string5 wa_string-string6 wa_string-string7 wa_string-string8

wa_string-string9

If # symbol is at end of the line

In runtime ABAP compiler recognizes # as CRLF.

Then instead of HORIZONTAL_TAB use CR_LF

Thanks and Regards,

0 Kudos

Hi Keshav and Chandra,

Both your solutions are not working....

thanks of your time, kindly try something else.

Kind Regards,

Bharat.

Former Member
0 Kudos

Hey ,

try using

"REPLACE all occurances of '#' by space " in your logic.

Hope this is helpful.

Regards,

Uma Dave

Former Member
0 Kudos

Hey ,

try using

"REPLACE all occurances of '#' by space " in your logic.

Hope this is helpful.

Regards,

Uma Dave

0 Kudos

Hi,

this is not a normal # repsesentation which could me removed using Replace '#' ......infact i have used that too.

this is smthing which comes right after the whole work area data

ex: abcd,kjasdh," ", asdjfh, # , 0#

the # in between can be remove by using Replace statement but not the END one, kindly cross check,

Please tell me any other possible options.

Kind Regards,

Bharat

kesavadas_thekkillath
Active Contributor
0 Kudos

Try with cl_abap_char_utilities=>CR_LF

kesavadas_thekkillath
Active Contributor
0 Kudos

Ignore

Edited by: Keshav.T on Jul 6, 2010 3:04 PM

0 Kudos

Hi keshav,

ENT must only be of these Data types C N D T or string.

Regards,

Bharat.

Subhankar
Active Contributor

Hi,

1. Get the hexadecimal value. Here you will get four char value.

2. Then get the special char using class cl_abap_conv_in_ce.

  • Get special char NON BREAK SPACE

call method cl_abap_conv_in_ce=>uccp

exporting

uccp = '00A0' "(This is hex value of special char)

receiving

char = v_rep.

3. Replace the special char in the string by space or anything you want.

replace all occurrences of v_rep in l_doknr with ' '.

Thanks

Subhankar

Former Member
0 Kudos

Hi Subhankar,

is the hexa decimal value correct for this.

I guess you are close, but this one too didnt work.

Kind Regards,

Bharat.

Former Member
0 Kudos

Hi subhankar,

The Hexa decimal valu would be 000D.

and its working fine thanks a lot for your support.

Bharat.

Former Member
0 Kudos

Hi subhankar,

The Hexa decimal valu would be 000D.

and its working fine thanks a lot for your support.

Bharat.

Former Member
0 Kudos

Hi All,

I am also facing the same problem...

when i enter the text in textEdit in BSP application, when there is a text with 2,3 lines in text edit...

i am getting # # in in string variable in debugging mode...This ## making my text with big gap in out put at line break...

by using the code below i am able to replece only one #. But unable to replace second #...

call method cl_abap_conv_in_ce=>uccp

exporting

uccp = '000D' "(This is hex value of special char)

receiving

char = v_rep.

replace all occurrences of v_rep in text1 with ' '.

how can i replce the second # in the text? I think , i need to pass other hexa value insted of "000D"?

Pls help to solve the problem.

Regards,

Kishan

navdeep_thakur12
Explorer
0 Kudos

Hi

check in debugging

if hex value for # is 000D

then use:

REPLACE ALL OCCURANCE OF cl_abap_char_utilities=>cr_lf(1) IN string WITH space.

if hex value is 000A

then use:

REPLACE ALL OCCURANCE OF cl_abap_char_utilities=>cr_lf+1(1) IN string WITH space.

similary you can check for HORIZONTAL_TAB, VERTICAL_TAB etc.

hope this help

Regards