‎2007 Apr 17 6:00 AM
Hi Experts,
sample flat file
"3508" "60003806" "100406425" "USD" "03/01/2007"
"3509" "60003807" "100406425" "USD" "03/01/2007"
the above flat file has double quote and tabdelimiter.
i use the FM gui_upload to upload this file to a string and remove ' " ' using FM 'WRB_UTIL_STRING_REPLACE'. But the file now contains '#' for tab delimiter.
example:
string = 3508#60003806#100406425#USD#03/01/2007.
without download it again is there any possible way to transfer these values to the corresponding fields of the i_tab (contains 5 fields).
Please reply as soon as possible
Thanks,
Ashok
‎2007 Apr 17 6:02 AM
Hi..,
<b>The character '#' can be a Horizontal tab or a new line or a Vertical tab...
Those '#' are special characters to indicates new line or tab. You need to use the abap objects CL_ABAP_CHAR_UTILITIES to fix this issue.</b>
constants :
C_HTAB value CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.
replace all occurrences of C_HTAB in w_string with space.
<b><i>OR TO GET THE FIELDS INTO INTERNAL TABLE..</i></b>
define a constant..
constants :
C_HTAB value CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB. <i>**<--Horizontal tab</i>
loop at i_input.
split i_input at C_HTAB into i_finaltab-field1 i_input.
split i_input at C_HTAB into i_finaltab-field2 i_input.
split i_input at C_HTAB into i_finaltab-field3 i_input.
split i_input at C_HTAB into i_finaltab-field4 i_input.
append i_tab.
endloop.
regards,
sai ramesh
‎2007 Apr 17 6:02 AM
Hi..,
<b>The character '#' can be a Horizontal tab or a new line or a Vertical tab...
Those '#' are special characters to indicates new line or tab. You need to use the abap objects CL_ABAP_CHAR_UTILITIES to fix this issue.</b>
constants :
C_HTAB value CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.
replace all occurrences of C_HTAB in w_string with space.
<b><i>OR TO GET THE FIELDS INTO INTERNAL TABLE..</i></b>
define a constant..
constants :
C_HTAB value CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB. <i>**<--Horizontal tab</i>
loop at i_input.
split i_input at C_HTAB into i_finaltab-field1 i_input.
split i_input at C_HTAB into i_finaltab-field2 i_input.
split i_input at C_HTAB into i_finaltab-field3 i_input.
split i_input at C_HTAB into i_finaltab-field4 i_input.
append i_tab.
endloop.
regards,
sai ramesh
‎2007 Apr 17 6:04 AM
‎2007 Apr 17 6:04 AM
try this
split STRING at '#' into table itab-field1 itab-field2 itab-field3 itab-field4 itab-field5.
append itab.
‎2007 Apr 17 6:07 AM