cancel
Showing results for 
Search instead for 
Did you mean: 

problem with fileupload!!!

Former Member
0 Kudos

Hi All,

I'm having few comma separated records in my notepad like this

aaa, bbbb, cc, dddddd

bbb,cccccc,dd,eee

I've uploaded these data using fileupload UI element into 'content' attribute which is of the type xstring.

now i've converted the xstring data to string..

now my string contains the data like this aaa, bbbb, cc, ddddddxxbbb,cccccc,dd,eee

i have an internal table which contains four fields and i want to break the string and append it into my itab in the above shown notepad format (

aaa, bbbb, cc, dddddd

bbb,cccccc,dd,eee )

but how is this possible how can split the string into individual records?

is it any other way which will upload the data into individual records rather than a single string.

i tried creating a node with cardinality 0..n and placed an attribute which is of type xstring and binded to fileupload UI element but it is throughing error. pls help me out..

regards

swapna

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Check out this piece of code..

data string type string value 'aaa, bbbb, cc, dddddd, bbb,cccccc,dd,eee'.

data string2 type string.

data string3 type string.

data : begin of fs,

col1(20) type c,

col2(20) type c,

col3(20) type c,

col4(20) type c,

end of fs.

data itab like table of fs.

string2 = string.

while string2 space.

split string2 at ',' into fs-col1 fs-col2 fs-col3 fs-col4 string2.

append fs to itab.

clear fs.

endwhile.

loop at itab into fs.

write / fs.

endloop.

thanks

mallika

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Swapna,

check the below code.

types:begin of ty_test,

v_col1(4),

v_col2(4),

end of ty_test.

data: v_string type string,

ls_string type string,

lt_string type table of string,

ls_test type ty_test,

lt_test type table of ty_test.

v_string = 'aaaa,bbbbxxcccc,dddd'.

split v_string at 'xx' into table lt_string.

loop at lt_string into ls_string.

split ls_string at ',' into ls_test-v_col1 ls_test-v_col2.

append ls_test to lt_test.

endloop.