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: 

How to remove # from the end of each lines of .csv file.

Former Member
0 Kudos

Hi ,

I have uploaded .csv file from my local m/c (windows) to application server (unix) thru. FM 'ARCHIVFILE_CLIENT_TO_SERVER'

Issue is when I open the file in AL11 it is showing # at end of each line. Click below link to see the output file.

[https://docs0.google.com/document/edit?id=1PzjhljdCC2Wgj9L1dZ51G4pHJ0G_7jJwQAMqcJHdggc&hl=en#]

Pls. help me how to remove all the # from the file.

Thanks in advance.

Devinder

10 REPLIES 10

Sandeep_Kumar
Product and Topic Expert
Product and Topic Expert
0 Kudos

Quick and dirty solution will be to find the strlen for each line and then delete the last char before writing the dataset,

Another option could be to use REPLACE ALL OCCURENCES OF keyword .

romanweise
Active Contributor
0 Kudos

Hi,

please note that the # at the end of each line is probably not the character from your keyboard. SAP displays non printable characters as #. So if you try to remove the character by the REPLACE ALL OCCURRENCES staement you have to hand over the correct character which is probably CR/LF or a part of it. What it is exactly depends usually on your OS an if your system is unicode or not. You can find constants for CL/RF in the standard class CL_ABAB_CHAR_UTILITIES.

Kind Regards

Roman

Former Member
0 Kudos

Dev,

default option for upload is set as BIN...

if you change it to ASC, then you wont ge the # at the end of the line..

0 Kudos

copy ARCHIVFILE_CLIENT_TO_SERVER to a Z FM and change the 'SCMS_UPLOAD' and 'SCMS_DOWNLOAD' as

binary   = ' '.

0 Kudos

Hi Soumyaprakash

Thanks for reply.

I copied in Z fm and changes as u suggested, but still the result is same.

Rgds

Devinder

0 Kudos

Hi ,

use this

Declare this

that # value is actually use of Tab in file

so in order to remove that use below code

DATA :C_TAB(1) TYPE c VALUE cl_abap_char_utilities=>HORIZONTAL_TAB .

loop at it_data .

refno = it_data-line .

REPLACE ALL OCCURRENCES OF c_tab IN refno WITH ''.

modify it_data .

endloop.

Regards

Deepak.

0 Kudos

Hi,

Thanks you all guys for reply this thread.

I have resolved this by using FM "GUI_UPLOAD" and then using open dataset.

I m closing this thread.

Once agine thank you all.

Rgds

Devinder Rawat

0 Kudos

Can you please share me the sample code

0 Kudos

12 years later ...

0 Kudos

This thread is from nearly a dozen years ago -- and it's filled with Former Members who won't receive notifications that you commented. You're unlikely to get answers in an inactive thread (beyond the reactions you've already seen). Try asking a new question instead at https://answers.sap.com/questions/ask.html.

I recommend that you familiarize yourself with https://community.sap.com/resources/questions-and-answers, as it provides tips for preparing questions that draw responses from our members. Feel free to take our Q&A tutorial at https://developers.sap.com/tutorials/community-qa.html as well, as that will also help you when preparing questions for the community.

Kind regards,

--Jerry

Moderation Lead

Make sure to subscribe to What's New!