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

Delete Carriage return from extracted data (flat file)

Former Member
0 Likes
2,456

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.

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
Read only

tarangini_katta
Active Contributor
0 Likes
1,270

Hi,

Try to use CL_ABAP_STRING_UTILITIES.

Thanks

Read only

Former Member
0 Likes
1,270

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.

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,270

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.

Read only

Former Member
0 Likes
1,270

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

Read only

Former Member
0 Likes
1,270

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

Read only

Former Member
0 Likes
1,270

Thank you all for your replies. Pb solved !