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: 

Carraige return

Former Member
0 Kudos

hi all!!

I have like 90,000 records which have the name, specifications, price and UOM fields.

I have all these in a tab delimited file downloaded from a company where the records are entered manually in their format into their db.

Now, few of these records have the fields rolled to the next line, which is causing problem to the prog I have to create based on this file. I could understand that it is because of the file from the company which has errors, ie, they hit enter, due to which it goes to the next line, causing problems to my prog.

So I would like to know how we can write a code which would delete the carriage return by checking each and every record, if it has any.

Pls help.

Thanks.

2 REPLIES 2

Former Member
0 Kudos

Hi Shekar,

Check this code.

to replace a carriage return with a space

  • begin of change by 0114_temp

data: cr type x value '0A', "(carriage return)

length type sy-fdpos.

  • end of change by 0114_temp

loop at it_data.

  • begin of change by 0114_temp

  • search for carriage returns and replace them

length = 1.

do.

search it_data-sgtxt for cr starting at length.

if sy-subrc = 0.

length = length + sy-fdpos .

replace cr with space into it_data-sgtxt.

modify it_data index sy-tabix transporting sgtxt.

else.

exit.

endif.

enddo.

Thanks

Mahesh

former_member181962
Active Contributor
0 Kudos

Once you have the data in the internal table after the upload,

loop at itab.

replace all occurences of CL_ABAP_CHAR_UTILITIES=>NEWLINE with '' in itab-data.

modify itab.

clear itab.

endloop.

Regards,

Ravi