2008 Aug 07 7:38 AM
HI ...
I am reading one csv file from application server..
for example there is one record in file
0000661723,PV,
But while reading in report using read dataset;
its reading as
661723,PV#
Now to remove # what i tried to do is using string function i have taken hash character into variable l_char i got # here..
but wen i use if l_char = # or if l_char = c_hash
it doesnt go into the processsing block of if...
directly it goes to next statement...
and similar thing happening with 'CS' and 'CA' keywords..
please help
regards
vivek
r
2008 Aug 07 7:45 AM
Are you doing cross platform transfers?
I mean is the file comming from a UNIX sytem to a Windows system or vice versa. read dataset normally doesnt read the end of line character unless the file was transfered incorrectly. IF you are doing cross platfor transfers you have to select the appropriate transfer mode so that the unix end of line character is replaced by windows end of line character or vice versa.
If the above statement is true for you then the hash you see is not actually a hash, instead it is the end of line character.
Just use the right transfer mode.
HI ...
I am reading one csv file from application server..
for example there is one record in file
0000661723,PV,
But while reading in report using read dataset;
its reading as
661723,PV#
Now to remove # what i tried to do is using string function i have taken hash character into variable l_char i got # here..
but wen i use if l_char = # or if l_char = c_hash
it doesnt go into the processsing block of if...
directly it goes to next statement...
and similar thing happening with 'CS' and 'CA' keywords..
please help
regards
vivek
r
2008 Aug 07 7:41 AM
HI,
inorder to identify that #
simply declare a variable as
c_hextab(1) TYPE x VALUE '09'.
u r probelm get solves..
regards,
Sunil Kumar
2008 Aug 07 7:43 AM
Hi,
Use this keyword cl_abap_char_utilities=>horizontal_tab
Please try like this
if l_char = cl_abap_char_utilities=>horizontal_tab
2008 Aug 07 7:45 AM
Are you doing cross platform transfers?
I mean is the file comming from a UNIX sytem to a Windows system or vice versa. read dataset normally doesnt read the end of line character unless the file was transfered incorrectly. IF you are doing cross platfor transfers you have to select the appropriate transfer mode so that the unix end of line character is replaced by windows end of line character or vice versa.
If the above statement is true for you then the hash you see is not actually a hash, instead it is the end of line character.
Just use the right transfer mode.
2008 Aug 07 7:59 AM
Hi...
Thx for such a promp reply....
sunil can u tell me which variable you want me to put as hex..
dummy code for ur reference..
DATA : ls_upload TYPE zet_sm_prog_stat,
l_count TYPE i,
l_char,
l_len TYPE i.
constants : c_hash type x value 09.
*Open Dataset
OPEN DATASET p_file_s FOR INPUT IN TEXT MODE.
IF sy-subrc EQ 0.
DO .
* CLEAR ls_upload.
* l_count = l_count + 1.
*Read File
READ DATASET p_file_s INTO gt_input_file-line.
* IF l_count EQ 1.
* CONTINUE.
* ENDIF.
IF NOT sy-subrc IS INITIAL.
EXIT.
ELSE.
l_len = strlen( gt_input_file-line ) - 1.
l_char = gt_input_file-line+l_len(1).
if l_char eq c_hash.
* IF gt_input_file-line CA '#'.
* if sy-fdpos <> l_len.
* l_len = l_len - 1.
gt_input_file-line = gt_input_file-line+0(l_len).
* endif.
ENDIF.
Gowri :
I think that utility works in 6.0 i am using 4.6 so is der a way to activate unicode in 4.6 also???
hi aparna..
I know that # is EOD.
Files are managed on unix only....
can you tell me how cross platform transfer should be done..
regards
vivek
2008 Aug 07 8:05 AM
How is the file reaching the appserver? If the file is comming from windows to unix, you have to select ASCII mode for transfer. THis will convert windows end of line character to unix end of line character
2008 Aug 07 8:12 AM
Hi aparna
I am not sure about how they manage to do that but we have been provided with a file manager interface where we have to drag n drop our files from desktop to unix directories...(eg unix path : /usr/swap/ )
ragards
vivek
2008 Aug 07 8:18 AM
Is there an option in the file manager setting to choose the transfer mode. If yes choose Ascii mode.
If not try using CG3Z to do drop the file to app server using ASCII mode
2008 Aug 07 10:26 AM
Hey aparna..
Thx a lot...
i tried the said transaction and its working...
regards
vivek
2008 Aug 07 7:49 AM
Hi,
This is because the # provided by SAP is different from the # you are defining.
Check the class cl_abap_char_utilities and in it the paramter
Cl_abap_char_utilities=>NEWLINE.
hope this helps.
thanks
Papiya
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |