Skip to Content
author's profile photo Former Member
Former Member

Remove # character from flat file in application server

Hi Experts,

I have a CSV file in application server from which i should extract data and pass into internal table.

At present i am using READDATASET to extract from flat file but a "#' character is available in my file and ii was unable to remove it.

Strange thing is that this '#' character is not seen when it is present in Presentation server(desktop).

I am able to replace other characters but i am unable to remove # character. I am also putting my code below.

DATA: l_sep1 TYPE c.

l_sep1 = cl_abap_char_utilities=>HORIZONTAL_TAB.

LD_FILE = '\\FWSAPDEV\sapmnt\EDI\Wal-Mart\in850\FoodService_PO_120712103756.csv'.

OPEN DATASET ld_file FOR INPUT IN TEXT MODE ENCODING NON-UNICODE IGNORING CONVERSION ERRORS.

IF SY-SUBRC NE 0.

ELSE.

DO.

CLEAR: WA_STRING, WA_HEADER.

READ DATASET LD_FILE INTO WA_STRING.

IF SY-SUBRC NE 0.

EXIT.

ELSE.

SPLIT WA_STRING AT l_sep1 INTO WA_HDR1

WA_DTL.

ENDIF.

ENDDO.

CLOSE DATASET LD_FILE.

ENDIF.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Posted on Jul 20, 2012 at 06:07 AM

    Hiii ,

    Try this ,

    DATA: str(10) TYPE c,
    v1(1) VALUE space,
    v2(2) VALUE '#'.

    str = 'test##test'.

    REPLACE ALL OCCURRENCES OF v2
    IN str WITH v1.

    WRITE: str.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 20, 2012 at 06:43 AM

    Hi Venkat,

    I encountered similar problem few months ago when I downloading data from my application server to my presentation server.

    The '#' appeared when I chose a wrong code page. For example, if the data contains Chinese character but I chose ASCII, all Chinese characters becomes '#' characters.

    I solved the problem by choosing UTF-8 (codepage:4110). Maybe you should try UTF-8. too.

    Please let us know whether it solves your problem or not.

    Good luck 😊

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 24, 2012 at 12:58 PM

    so, look at the character in debug and see what the hex value is and use a hex chart to figure out what that character is...then research why/how you are getting that. Is it coming at end of line in some display tool? If so, could be CR or LF character, hex 0D or 0A.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 24, 2012 at 07:10 PM

    I had faced same problem please check the format when your uploading set the mode as text if your uploading a text file and if its hash separated set the mode accordingly.

    Thanks,

    Vijay

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.