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

How to remove '#'-sign from string

Olaf_B
Explorer
0 Likes
788

Hi,

using file upload into internal table i've got '#' signs. In the main body of the table they are separators and are always on specific places.

In the header of the table they are at different places (and they are varying).

Exampleline:

0024 Company XYZ #Summary report November 2006

I've tried REPLACE, but the '#'-sign is not recognized

I've tried TRANSLATE, but it doesn't work

So the '#' sign is NOT equal with the one from your keyboard. It's a control character within files.

Any clues?

Regards

Olaf

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
636

Hi Olaf

I guess the "#" is tab character.

Please use the below method and check if it works:

data: tab(1) type c value cl_abap_char_utilities=>horizontal_tab,
        str type string.

open dataset <dsn> for input in text mode encoding default.
if sy-subrc eq 0.
  do.
    read dataset <dsn> into str.
    if sy-subrc ne 0.
       exit.
    else.
       split str at tab into <wa>-fld1 <wa>-fld2....
       append <wa> to <itab>.
    endf.
  enddo.
  close dataset <dsn>.
endif.

Hope this helps.

Kind Regards

Eswar

Hi,

using file upload into internal table i've got '#' signs. In the main body of the table they are separators and are always on specific places.

In the header of the table they are at different places (and they are varying).

Exampleline:

0024 Company XYZ #Summary report November 2006

I've tried REPLACE, but the '#'-sign is not recognized

I've tried TRANSLATE, but it doesn't work

So the '#' sign is NOT equal with the one from your keyboard. It's a control character within files.

Any clues?

Regards

Olaf

3 REPLIES 3
Read only

Former Member
0 Likes
636

hi Olaf,

Check this out

Regards,

Santosh

Read only

Former Member
0 Likes
636

Hi,

try reading the file in Text mode.

Read only

Former Member
0 Likes
637

Hi Olaf

I guess the "#" is tab character.

Please use the below method and check if it works:

data: tab(1) type c value cl_abap_char_utilities=>horizontal_tab,
        str type string.

open dataset <dsn> for input in text mode encoding default.
if sy-subrc eq 0.
  do.
    read dataset <dsn> into str.
    if sy-subrc ne 0.
       exit.
    else.
       split str at tab into <wa>-fld1 <wa>-fld2....
       append <wa> to <itab>.
    endf.
  enddo.
  close dataset <dsn>.
endif.

Hope this helps.

Kind Regards

Eswar