‎2010 Jun 18 9:41 AM
HI Experts,
I am unable to SPLIT in a string after reading (read dataset) from a text file in application server.
On the command SPLIT in the code below - the output does not split AT '#' or any characters after it is read from the application server.
Anyone know what is the problem?
The file is uploaded from my Excel file and save it to a text file (tab delimited) and then upload into the application server using CG3Z as ANSI.
But it does not work.
I then test to copy and replace the variable with the same string record back into lv_data_string before SPLIT in DEBUG mode and splits perfectly.
OPEN DATASET P_LGFILE FOR INPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc EQ 0.
DO.
READ DATASET P_LGFILE INTO lv_data_string.
IF sy-subrc NE 0.
EXIT.
ENDIF.
CLEAR wa_string.
SPLIT lv_data_string AT '#' INTO wa_string-string1 wa_string-string2 wa_string-string3 wa_string-string4 wa_string-string5
wa_string-string6 wa_string-string7 wa_string-string8 wa_string-string9.
APPEND wa_string TO lt_string.
ENDDO.
ENDIF.
Kindly advice.
Thanks in advance
CW
‎2010 Jun 18 9:55 AM
In runtime ABAP compiler recognizes # as tab delimiter.
You try below code:
DATA: l_sep1 TYPE c.
l_sep1 = cl_abap_char_utilities=>HORIZONTAL_TAB.
SPLIT lv_data_string AT l_sep1 INTO wa_string-string1 wa_string-string2 wa_string-string3 wa_string-string4
wa_string-string5 wa_string-string6 wa_string-string7 wa_string-string8
wa_string-string9.Thanks and Regards,
Chandra
‎2010 Jun 18 9:54 AM
The hash sign has to functions in character and string variables.
1) the hash sign itsself
2) a replacement for all not printable characters like 09x. If you are looking at the file the hash sign may represent another character. Checkl if the fiule really contains a hash sign. In most cases this is a TAB sign instead.
‎2010 Jun 18 9:55 AM
In runtime ABAP compiler recognizes # as tab delimiter.
You try below code:
DATA: l_sep1 TYPE c.
l_sep1 = cl_abap_char_utilities=>HORIZONTAL_TAB.
SPLIT lv_data_string AT l_sep1 INTO wa_string-string1 wa_string-string2 wa_string-string3 wa_string-string4
wa_string-string5 wa_string-string6 wa_string-string7 wa_string-string8
wa_string-string9.Thanks and Regards,
Chandra
‎2010 Jun 18 12:09 PM
HI ALL,
It works Briliantly !!
Thank You so much !
All the best !
Regards
CW