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: 

Delete Carriage return from extracted data (flat file)

Former Member
0 Kudos

Hello Abappers,

I'm facing the following problem, i need to delete the carraiage return code CR from the extracted file. I've done some research for that and found some topics talking about using 'cl_abap_char_utilities=>CR_LF', but unfortunitly we have SAP 4.6C wich doesn't have this class. Is there any way to delete these CRs ?

Thank you in advance.

Best Regards.

6 REPLIES 6

tarangini_katta
Active Contributor
0 Kudos

Hi,

Try to use CL_ABAP_STRING_UTILITIES.

Thanks

Former Member
0 Kudos

Hi,

See below sample code for deleting the carriage return code. Hope it give u some idea.

CONSTANTS: c_cr TYPE x VALUE '0D'. " Carriage Return

  • Check for Carriage Return in longText

DO.

SEARCH i_lines-tdline FOR c_cr.

IF sy-subrc = 0.

REPLACE c_cr WITH space INTO i_lines-tdline.

ELSE.

EXIT.

ENDIF.

ENDDO.

SuhaSaha
Advisor
Advisor
0 Kudos

Hello,

The HEX value of CRLF is '0D0A'.

DATA: V_CRLF TYPE X VALUE '0D0A'.

You can try using this.

BR,

Suhas

PS: Have a look in SDN may be you can find some solutions.

Former Member
0 Kudos

Hi Fayssal,

Declare an hexadecimal variable which holds value '0D0A' and use REPLACE to delete carriage returns.

DATA: V_CR(2) type X value '0D0A'. 

replace all occurrences of V_CR in str with space.

Thanks,

Vinay

Former Member
0 Kudos

Hi,

Attribute 'cl_abap_char_utilities=>CR_LF' is just a constant and its value is '0D' in hexa. So you can use '0D' (type X) instead.

To delete the CRs in your text you have to you must process your text in hexa mode and clear the '0D' in each line.

Hope this will help you,

Issa

Former Member
0 Kudos

Thank you all for your replies. Pb solved !