09-11-2008 3:59 PM
Hi all,
After uploading the data from flat file into an internal table the data consists of # between each field and while I try to split each field and assign to a different table the data is not getting split properly ,
i.e. split function splits the fields after 3 '#' and storing it in the table field.
Thanks & Regards
Jerry
09-11-2008 4:11 PM
Hello Jerry
I once had to re-engineer an upload program where the data in the flat file were separated using "¦". The report tried to split the flat file using fm TEXT_CONVERT_TEX_TO_SAP (I_FIELD_SEPERATOR = "¦").
The file splitting did not work because the "¦" in the file was different from the "¦" used as input for the fm. However, you could see the difference only in debugging mode when you switch the display mode from TEXT to HEX.
Perhaps you are dealing with a similar problem. In addition, the Unicode format (UTF-8) may play a role. Do you upload your file from the local PC. If so then use CL_GUI_FRONTEND_SERVICES=>GUI_UPLOAD because the corresponding fm GUI_UPLOAD is not Unicode-compatible.
If the flat file uses an exotic field separator I recommend to replace it with a simple semicolon (";").
Regards
Uwe
09-11-2008 4:11 PM
Hello Jerry
I once had to re-engineer an upload program where the data in the flat file were separated using "¦". The report tried to split the flat file using fm TEXT_CONVERT_TEX_TO_SAP (I_FIELD_SEPERATOR = "¦").
The file splitting did not work because the "¦" in the file was different from the "¦" used as input for the fm. However, you could see the difference only in debugging mode when you switch the display mode from TEXT to HEX.
Perhaps you are dealing with a similar problem. In addition, the Unicode format (UTF-8) may play a role. Do you upload your file from the local PC. If so then use CL_GUI_FRONTEND_SERVICES=>GUI_UPLOAD because the corresponding fm GUI_UPLOAD is not Unicode-compatible.
If the flat file uses an exotic field separator I recommend to replace it with a simple semicolon (";").
Regards
Uwe
09-11-2008 4:27 PM
Hi Uwe,
I appreciate your help!!!
Even though I am using CL_GUI_FRONTEND_SERVICES=>GUI_UPLOAD to upload the data the problem remains the same. The data in flat file is tab delimited and after uploadind it internal table it is
seperated by '#' and even though using SPLIT function its not splitting the fields after each occurence of '#'.
Regards
Jerry
09-13-2008 4:54 PM
Hi Jerry,
What Uwe said is correct. We too faced that kind of scenario. In the internal table when uploaded from flat file it will show '#' but it wont get split with '#' symbol in the program. However we solved the issue with the following class.
Data: c_tab value cl_abap_char_utilities=>newline,
it_string type table of string.
" if it_table1 is the table which contains the flat file data, then go throuhg this logic.
loop at it_table1 into wa_table1.
split wa_table1 at c_tab into table it_string.
endloop.
If the table is not getting split with cl_abap_char_utilities=>newline, then try using differnt attributes of that class ( like cl_abap_char_utilities=>cr_lf, cl_abap_char_utilities=>backspace so on ).
Hope this will help.
Regards,
Swarna Munukoti.
Edited by: Swarna Munukoti on Sep 13, 2008 5:54 PM
09-13-2008 3:30 PM
Hi
check sy-subrc ..if it is 4 , means ur split stmt is not being executed.........
to check this u count the no of fields of Int table to be splitted.
it should match with the no. of parameters specified in split stmt....
09-15-2008 9:42 AM
Hi ,
I came across same scenario .... i solved this problem....
Misleading part in this is "#" u see in debugging mode .... data uploaded from tab delimited file will have tab between fields , but it will show "#".
define a data
DATA : V_TAB TYPE C VALUE CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.
and use like
split ur_string at V_TAB ................
I am sure that it will work ....
Njoy