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 get rid of '#' in ABAP program ?

Former Member
0 Kudos

Hi, Gurus:

Our ABAP report reads flat file, the file is created by a legacy system.

Previously, it works fine.

Recently, the each line of file ended with symbol '#'.

We want to get rid of it, but not lucky:

We have tried using replace it with '', and tried using SHIFT by one space, all does not work.

Any one have good suggestion ?

Thanks in advance.

Liang

1 ACCEPTED SOLUTION

former_member223537
Active Contributor
0 Kudos

Hi,

Get the length of the record for each line & reduce the length by 1.

loop at gt_tab into watab.
delete trailing spaces of wa_tab-data.........
lv_len = strlen(wa_tab-data),
lv_len = lv_len - 1.
lv_data = wa_tab-data+0(lv_len).  " lv_data will have the data without #
..........
.............
.............
endloop.

Best regards,

Prashant

7 REPLIES 7

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Yes, try to replace the CR_LF character.

For example.....

replace CL_ABAP_CHAR_UTILITIES=>CR_LF  with space in v_string.

Regards,

Rich Heilman

0 Kudos

Hi, Rich:

Thank you for your valuable input.

I have tried your suggestion, but it does not work yet:

when I debug our program, I shift the string, with only '#' left,

now I saw its value is '000D002000200020'

its type is: \TYPE=%_T00006S00000000O0000000289

any idea ?

Thanks

Liang

0 Kudos

Check the file you upload.

It may have blanck space at the end. You need to clear that off before uploading into SAP.

Regards

Mohan

0 Kudos

Mohankumar:

I also tried deleting all the tailing spaces and it does not help...

More ideas ?

Liang

0 Kudos

Create a file on your own... Don't try to copy the values from the existiung file. You key in the values on your own... SAVE it and upload it using the same program.

This is to check whether "content of the file" coming from Legacy file is Compatible with SAP or not.

May be this would help you to find the root cause...

Regards

Mohan.

Former Member
0 Kudos

when you read line , you can use subtr to remove the last chacterif it is '#'.

former_member223537
Active Contributor
0 Kudos

Hi,

Get the length of the record for each line & reduce the length by 1.

loop at gt_tab into watab.
delete trailing spaces of wa_tab-data.........
lv_len = strlen(wa_tab-data),
lv_len = lv_len - 1.
lv_data = wa_tab-data+0(lv_len).  " lv_data will have the data without #
..........
.............
.............
endloop.

Best regards,

Prashant