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: 

Replacing # symbol in extract file

former_member671224
Participant
0 Kudos

Hi,

Im creating one extract file in application server, and i need to replace all # symbols occured in the file with space. I used

1): REPLACE ALL OCCURRENCES OF CL_ABAP_CHAR_UTILITIES=>CR_LF

IN WorkArea WITH space.

2): REPLACE ALL OCCURRENCES OF CL_ABAP_CHAR_UTILITIES=>newline

IN WorkArea WITH space.

3): REPLACE ALL OCCURRENCES OF '#'

IN WorkArea WITH space.

First is not working.

second is also not working.

third is working in DEV but when the object was moved to next environment(Quality Server) its not working.

Since the third option was already moved to quality and its not working over there, I tried other 2 option but they are not working in Development server.

Please suggest how to fix this issue.

Thanks,

Amal

21 REPLIES 21

SuhaSaha
Advisor
Advisor
0 Kudos

Hello,

Im creating one extract file in application server

Then go & check in your code how you have populated the file. I suppose that if you use CRLF or NEWLINE as a separator, then they will be displayed as '#' in the file.

But if you download the file to presentation server you can see the file is being displayed correctly (w/o any '#').

BR,

Suhas

0 Kudos

Im creating a file as tab delimiter using cl_abap_char_utilities=>horizontal_tab. So before creating im trying to replace all '#' symbols in the workarea with space, but its replacing in Development server but not in Quality server.

When I download the file its having the '#' symbol in it.

Thanks,

Amal

Former Member
0 Kudos

Hi,

Use TRANSLATE V_VAL USING '# space'.

Thanks & Regards

Rajasekhar.T

0 Kudos

I tried translate also, its working in DEvelopment but not in quality server...

Former Member
0 Kudos

Hi ,

The third dtatement should work in the quality also .

I think you are downloading using binary mode.

Try to download it from the application server in TEXT MODE .

If you read or transfer from the application server in text mode the # will not come.

...... .. IN TEXT MODE ENCODING  DEFAULT.

Regards

Pinaki

0 Kudos

Im creating the file in application server using

OPEN DATASET file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.

The main issue is, REPLACE and TRANSLATE is working in development server but not in quality server.

Thanks,

Amal

Former Member
0 Kudos

Hi,

Try like below:


data: l_sel type CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.
REPLACE ALL OCCURRENCES OF l_sel IN WorkArea WITH space.

Regards,

Himanshu

0 Kudos

I tried as,

data: l_sel type CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.

REPLACE ALL OCCURRENCES OF l_sel IN WorkArea WITH space.

but its not working.

Thanks,

Amal

0 Kudos

Hey Man,

A small issue there it should be like below:


data: l_sel value CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.

Regards,

Himanshu

0 Kudos

I tried using variable by assigning horizandal tab to it and used it and used directly. both not working.

data: l_hash value CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.

REPLACE ALL OCCURRENCES OF CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB

IN WorArea

WITH space.

REPLACE ALL OCCURRENCES OF l_hash

IN WorArea

WITH space.

It loks like something related to system or appliction settings. but i dont what is missing.

former_member223537
Active Contributor
0 Kudos

Hi Amal,

I dont see any issue with # displayed in a file when you open it in AL11.

Download the file to presentation server ( your local system) using CG3Y transaction & check the file -- # will not be displayed.

Thanks,

Best regards,

Prashant

0 Kudos

User is using some third party tool to download file from application server. and its considering as ab delimited if its having # symbol in file.

0 Kudos

Hello,

Does the user need the file to be tab delimited? If so keep your logic, else as suggested by Prashant remove it.

Its for the best interest of both.

BR,

Suhas

0 Kudos

User need the file to be tab delimited.

-Amal

former_member223537
Active Contributor
0 Kudos

Hi Amal,

Well in that case i would suggest to change the logic of populating the file itself.

Remove the logic of including a TAB between data of each field. You will have to modify the OPEN DATASET... TRANSFER... logic.

Thanks,

Best regards,

Prashant

0 Kudos

Prashant,

Before populating the field values into ITAB im replacing all # with space. And its working for few occurance. Its not working only in few places. Example, the symbol in the text as " something having text with symbol##' , the last 2 character having #, but those are not replacing by space. I felt its not workin only when # symbol is having in the last. So i tried to replace line feed asREPLACE ALL OCCURRENCES OF CL_ABAP_CHAR_UTILITIES=>CR_LF. but that also didnot works.

-Amal

Former Member
0 Kudos

Hello Amal,

For replacing # with space write the following code:

CONSTANTS: c_hash TYPE abap_cr_lf VALUE cl_abap_char_utilities=>cr_lf.

REPLACE ALL OCCURRENCES OF c_hash IN workarea WITH '  '.

And the process of adding space is Type 'and then press Alt type 255 and remove Alt. This will take one space. Then close by '.

Definately this will solve your problem.

Thanks,

Shobhit

0 Kudos

Shobhit,

I tried its not working..

0 Kudos

I have also faced the same problem. As per my understanding this is a interface program and code is written in include which gets triggers when outbound or may be inbound delivery is created. When user maintains the text # gets appended and due to which new line gets created. So we need to replace this by space. By direclty writting Space in syntax Replace all occurance is not readable to editor. We need to do Alt 255 to make that in ASCII. If you require sample code i can send it to you.

Thanks,

Shobhit

0 Kudos

Shobhit,

when I tried using replace all occurance of WA with space its working in DEV server but when its moved to QTY server its not working..

Please provide sample code

Thanks,

amal

Edited by: Amal on Jun 23, 2009 10:36 AM

Former Member
0 Kudos

Hello,

I also faced the same issue.. got resolved by using the following statement.

OPEN DATASET FILEPATH FOR INPUT IN TEXT MODE

                      ENCODING UTF-8 WITH WINDOWS LINEFEED SKIPPING BYTE-ORDER MARK

                      IGNORING CONVERSION ERRORS.

Thanks,

Prakash