2012 Jul 20 6:33 AM
Hi Experts,
I have a CSV file in application server from which i should extract data and pass into internal table.
At present i am using READDATASET to extract from flat file but a "#' character is available in my file and ii was unable to remove it.
Strange thing is that this '#' character is not seen when it is present in Presentation server(desktop).
I am able to replace other characters but i am unable to remove # character. I am also putting my code below.
DATA: l_sep1 TYPE c.
l_sep1 = cl_abap_char_utilities=>HORIZONTAL_TAB.
LD_FILE = '\\FWSAPDEV\sapmnt\EDI\Wal-Mart\in850\FoodService_PO_120712103756.csv'.
OPEN DATASET ld_file FOR INPUT IN TEXT MODE ENCODING NON-UNICODE IGNORING CONVERSION ERRORS.
IF SY-SUBRC NE 0.
ELSE.
DO.
CLEAR: WA_STRING, WA_HEADER.
READ DATASET LD_FILE INTO WA_STRING.
IF SY-SUBRC NE 0.
EXIT.
ELSE.
SPLIT WA_STRING AT l_sep1 INTO WA_HDR1
WA_DTL.
ENDIF.
ENDDO.
CLOSE DATASET LD_FILE.
ENDIF.
Hi Michael,
I was able solve this issue by using following code.
DATA: CR(1) TYPE C,
WA_STRING TYPE STRING.
CR = CL_ABAP_CHAR_UTILITIES=>CR_LF.
SPLIT WA_STRING at CR into TABLE INT_TXT.
If this helpful please reward points
2012 Jul 20 7:07 AM
Hiii ,
Try this ,
DATA: str(10) TYPE c,
v1(1) VALUE space,
v2(2) VALUE '#'.
str = 'test##test'.
REPLACE ALL OCCURRENCES OF v2
IN str WITH v1.
WRITE: str.
2012 Jul 20 7:43 AM
Hi Venkat,
I encountered similar problem few months ago when I downloading data from my application server to my presentation server.
The '#' appeared when I chose a wrong code page. For example, if the data contains Chinese character but I chose ASCII, all Chinese characters becomes '#' characters.
I solved the problem by choosing UTF-8 (codepage:4110). Maybe you should try UTF-8. too.
Please let us know whether it solves your problem or not.
Good luck
2012 Jul 25 11:46 AM
Hi Michael,
I was able solve this issue by using following code.
DATA: CR(1) TYPE C,
WA_STRING TYPE STRING.
CR = CL_ABAP_CHAR_UTILITIES=>CR_LF.
SPLIT WA_STRING at CR into TABLE INT_TXT.
If this helpful please reward points
2012 Jul 25 11:54 AM
You started the discussion, so only you can mark replies as helpful or correct. You can mark your own reply as correct, however this will not assign any points to yourself, but that's not what we are here for anyway, right?
Thomas
2012 Jul 25 12:09 PM
Hi Thomas,
I was not knowing about this since the same issue was getting someone so i told like that.....
2012 Jul 24 1:58 PM
so, look at the character in debug and see what the hex value is and use a hex chart to figure out what that character is...then research why/how you are getting that. Is it coming at end of line in some display tool? If so, could be CR or LF character, hex 0D or 0A.
2012 Jul 24 8:10 PM
I had faced same problem please check the format when your uploading set the mode as text if your uploading a text file and if its hash separated set the mode accordingly.
Thanks,
Vijay
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |