2012 Aug 10 11:38 AM
Hi all,
I am trying to read application server file to internal table and displaying in ALV format.
But while reading data from application server the data has '#", kindly advice me how to remove it.
Want to remove the special chararcet '#" from the internal table.
Regards,
Rohini
2012 Aug 10 11:45 AM
2012 Aug 10 11:51 AM
2012 Aug 10 12:17 PM
Kindly can u advice me wat are the option currently in my code, we have
OPEN DATASET p_path1 FOR INPUT IN TEXT MODE ENCODING DEFAULT.
Regards,
Rohini
2012 Aug 10 12:44 PM
Hi Rohini,
First check the data in application server by using AL11.If the data contains # in Application server then try below code.
OPEN DATASET P_PATH1 FOR INPUT IN BINARY MODE.
Regards,
Pradeep.P
2012 Aug 10 1:04 PM
Hi Pradeep,
I tried this code also, but it is pickin only the first row.
It is not picking all the rows from the application server.
Regards,
Rohinit.
2012 Aug 13 9:28 PM
You need to read the lines in a loop, something like this:
OPEN DATASET filepath FOR INPUT IN TEXT MODE ENCODING DEFAULT.
<...>
WHILE sy-subrc = 0.
READ DATASET filepath INTO <structure>.
IF sy-subrc <> 0.
EXIT.
ENDIF.
APPEND <structure> TO i_table.
ENDWHILE.
I also used READ DATASET into xstring type variable for binary files.
However, it might be more complex than you think and there might be more to it than removing '#' characters. This looks similar to a wire payment file and those need to be opened by a special transaction.
2012 Aug 13 11:33 PM
Hi Rohini,
Character # can be anything. It can be actually be HASH or it can be any character which cannot be represented. Eg. Tabs, Enter characters, character set not included in your codepage Eg. Japanese on English language. You need to find out what it is you are dealing with here.
PS - All the special characters are under cl_abap_char_utilities. Eg tab is cl_abap_char_utilities=>horizontal_tab.
Regards,
Shravan
2012 Aug 14 9:55 AM
Hi,
Using OPEN DATASET keyword to read a file from application server, there are chances these might not get converted perfectly.
use the extension IGNORING CONVERSION ERRORS to the OPEN DATASET statement.
example:
OPEN DATASET P_PATH1 FOR INPUT IN TEXT MODE ENCODING DEFAULT IGNORING CONVERSION ERRORS.
2012 Aug 14 10:20 AM
Hi,
First check the data inapplication server how its contain. If its contain is # or , seperater of each field value. And also check the what is the separter of each line end with is it # on blank. So based on the separter you can read data internal table of string type.
You can try using bellow class method. May help out you.
CALL METHOD cl_rsan_ut_appserv_file_reader=>appserver_file_read
EXPORTING
i_filename = lv_err_path
CHANGING
c_data_tab = it_out
EXCEPTIONS
open_failed = 1
read_failed = 2
close_failed = 3
OTHERS = 4.
here lv_err_apth application server file name and it_out type string type is internal table type of reading data.
Then you can format the data of which you requried from it_out internal table.
Regards,
Suresh M
2012 Aug 16 1:13 PM
Hi Suresh,
I tried ur code, then also in my internal table i am getting the data withh "#" symbol.
Please find the screen shot.
And when i try to replace the # symbol, i am not able to do.
Kindly advice me wat to do.
Regards,
Rohini
2012 Aug 16 1:34 PM
2012 Aug 16 1:44 PM
Hi all,
Please find my code below.
REPORT ZSTEST.
TYPE-POOLS: RSANM.
DATA :DSN VALUE '\\NY-ECCDEVSRVR\ECD_INTERFACES\EUR\3010\A\0491' TYPE STRING.
DATA : RECORD(100) .
DATA: IT_OUT TYPE RSANM_FILE_TABLE.
CALL METHOD cl_rsan_ut_appserv_file_reader=>appserver_file_read
EXPORTING
i_filename = DSN
CHANGING
c_data_tab = it_out
EXCEPTIONS
open_failed = 1
read_failed = 2
close_failed = 3
OTHERS = 4.
In the application server my data is in this form
But in the internal table it is coming in this format
2012 Aug 16 2:19 PM
In the debug mode if the SUBRC = 0 i think your data has been read successfully.
Try to write the internal table data by write statement and see'#' symbol is printing or not.
Thanks,
Pradeep.
2012 Aug 16 2:19 PM
In the debug mode if the SUBRC = 0 i think your data has been read successfully.
Try to write the internal table data by write statement and see'#' symbol is printing or not.
Thanks,
Pradeep.
2012 Aug 16 2:19 PM
In the debug mode if the SUBRC = 0 i think your data has been read successfully.
Try to write the internal table data by write statement and see'#' symbol is printing or not.
Thanks,
Pradeep.
2012 Aug 16 2:25 PM
Hi Pradeep,
I tried to write the internal table data, then also the # symbol is coming.
Please find the screen-shot.
Regards,
Rohini.
2012 Aug 16 2:55 PM
Okay some times the delimiter will be used as '#' so only its printing that too.
Anyway lets wait for the correct replies
2012 Aug 16 2:55 PM
Okay some times the delimiter will be used as '#' so only its printing that too.
Anyway lets wait for the correct replies
2012 Aug 16 2:55 PM
Okay some times the delimiter will be used as '#' so only its printing that too.
Anyway lets wait for the correct replies
2012 Aug 16 3:02 PM
2012 Aug 16 3:14 PM
I think your code is correct the '#' is the delimiter only(TAB) .
2012 Aug 16 1:37 PM
2012 Aug 16 1:55 PM
Hi Raymond,
I think the client is running some script and get that file in application server
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |