2010 May 26 7:30 PM
*Hi All ,*
*I am getting a file from Application Server with pipe separator.*
*BUt My issue is Data that is coming from Application Server is having doubles quotes which is having pipe Seperator in it.*
I want to consider the total field in double quotes as single field rather than two fields ignoring the pipe seperator in it.
My File looks like this.
USD|1.00|M|N|DINNER||"TOAST|KITCHEN & WINE BAR"|
I want to consider ||"TOAST|KITCHEN & WINE BAR"| as a single field instead of two fields ignoring pipe separator in it.
Thanks in Advance.
<< Please do not offer "rewards" >>
Edited by: Rob Burbank on May 26, 2010 2:43 PM
*Hi All ,*
*I am getting a file from Application Server with pipe separator.*
*BUt My issue is Data that is coming from Application Server is having doubles quotes which is having pipe Seperator in it.*
I want to consider the total field in double quotes as single field rather than two fields ignoring the pipe seperator in it.
My File looks like this.
USD|1.00|M|N|DINNER||"TOAST|KITCHEN & WINE BAR"|
I want to consider ||"TOAST|KITCHEN & WINE BAR"| as a single field instead of two fields ignoring pipe separator in it.
Thanks in Advance.
<< Please do not offer "rewards" >>
Edited by: Rob Burbank on May 26, 2010 2:43 PM
2010 May 26 8:21 PM
Hi,
try:
CONSTANTS: w_tab TYPE c VALUE %_horizontal_tab.
data: begin of i_text occurs 0,
w_line(1000),
end of i_text.
data: w_ct type i,
w_pos type i,
w_len type i.
data: w_flag,
w_field1(10),
w_field2(10),
w_field3(10),
w_field4(10),
w_field5(10),
w_field6(10),
w_field7(100),
w_field8(10).
i_text-w_line = 'USD|1.00|M|N|DINNER||"TOAST|KITCHEN & WINE BAR"|'.
append i_text.
loop at i_text.
w_len = strlen( i_text ).
w_ct = 0.
while w_ct < w_len.
if w_flag is initial and i_text+w_ct(1) = '|'.
i_text+w_ct(1) = w_tab.
elseif i_text+w_ct(1) = '"'.
if w_flag is initial.
w_flag = 'X'.
else.
clear w_flag.
endif.
endif.
w_ct = w_ct + 1.
endwhile.
split i_text at w_tab into w_field1 w_field2 w_field3
w_field4 w_field5 w_field6
w_field7 w_field8.
write: / w_field1, w_field2, w_field3, w_field4, w_field5, w_field6,
w_field7, w_field8.
endloop.Best regards,
Leandro Mengue
2010 Jun 04 7:13 PM
Hi ,
Thanks for your reply but in my file double quotes comes dynamically and it has to updated two database table.
Is there any way wa can replace the '|' separator between the double quotes in that string without splitting the string in that case.
Thanks ,
Naveen
| User | Count |
|---|---|
| 6 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |