Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

problem in converting flat file

Former Member
0 Likes
577

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
537

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

4 REPLIES 4
Read only

Former Member
0 Likes
538

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

Read only

Former Member
0 Likes
537

hi Ashok,

Refer

Regards,

Santosh

Read only

Former Member
0 Likes
537

try this

split STRING at '#' into table itab-field1 itab-field2 itab-field3 itab-field4 itab-field5.
append itab.

Read only

Former Member
0 Likes
537

give File Type = DAT.

Regards

Prabhu