‎2005 Aug 23 8:11 AM
Hi All,
I have an old program which is throwing up an issue.
I am succesfully uploading a tab-delimited(DAT) text file from a local server using the 'UPLOAD' Function Module. But when I try to use the same file saved in the application server and upload it using 'OPEN DATASET P_FILE FOR INPUT IN TEXT MODE' statement and next 'READ DATASET P_FILE INTO INT_TABLE', it is not considering the tab-delimiters and reading the adjacent fields into a single field using # as the separator
For example in the text file I have 3 fields
Field1 Field2 Field3
AAAAA BBBBB CCCCC
After the READ DATASET statement the work area is being populated as <wa>-field1 = AAAAA#BB
<wa>-field2 = BBB#CCC
<wa>-field3 = CC
The field length's of the 3 fields are 8, 7 & 7 respectively.
Could you suggest me a solution such that the fields are populated as below
<wa>-field1 = AAAAA
<wa>-field2 = BBBBB
<wa>-field3 = CCCCC
Thanks,
Karthik
‎2005 Aug 23 8:16 AM
may be you have to split it manually
split <text> at CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB into filed1 field2 field3 etc.
Regards
Raja
‎2005 Aug 23 8:16 AM
may be you have to split it manually
split <text> at CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB into filed1 field2 field3 etc.
Regards
Raja
‎2005 Aug 23 8:21 AM
Durai,
Thanks for the answer but this OO Concept CL_ABAP_CHAR_UTILITIES is not available in 4.6C.
Regards,
Karthik
‎2005 Aug 23 8:22 AM
Karthik,
Then use:
data: g_delim(1) type x value '09'.
Cheers,
Pat.
‎2005 Aug 23 8:24 AM
data : tab type x .
move: '09' to tab .
now use tab in place of CL_ABAP_CHAR_UTILITIES=>horizontal_tab
Regards
Raja
‎2005 Aug 23 9:44 AM
Hi,
I will try this, but could you please explain what is the significance of '09'. I have not understood that.
Thanks,
Karthik
‎2005 Aug 23 9:46 AM
‎2005 Aug 23 9:49 AM
Hi,
data: hor_tab type x value '09'.
is the hex value of horizontal tab. When you work in binary mode you can read this values and split your fields at it.
Svetlin
P.S. In case you find some answers useful, please assign reward poits.
‎2005 Aug 23 8:17 AM
Hi Karthik,
Try something like this:
data: g_data(1000) type c,
g_delim TYPE c value cl_abap_char_utilities=>horizontal_tab. "Tab Delim
open dataset....
read dataset into g_data.
split g_data at g_delim into ....
append ....
Let me know how this goes.
Cheers,
Pat.
‎2005 Aug 23 8:17 AM
Hi,
Open the dataset in IN BINARY MODE ( not in text mode ) and use SPLIT stmt at tab.
Svetlin