‎2006 Sep 28 12:58 PM
Hi All,
I have an internal table with character type data.
I have some 200 structures having some non-character fields like DEC and INT.
Now i want to split the line of internal table in to these structure fields one by one.
But the problem is SPLIT is a string function and only allows character type Field attributes.
Is there any way out, to SPLIT string in some non character fields?
‎2006 Sep 28 1:05 PM
data : begin of itab occurs 0,
str type string,
end of itab.
loop at it_char.
split it_char at <delimiter> into table itab.
endloop.now loop at the ne itab and extract ur values
not sure if it can satify ur requirement
‎2006 Sep 28 1:01 PM
Hi,
Insted of Splitting the ITAB data using SPLIT, why don't you use the <b>offsets</b>,
Move:itab-data+0(10) to DEC.
Move:itab-data+10(20) to DEC.
Regards
Sudheer
‎2006 Sep 28 1:16 PM
Hi Sudheer,
Offsets can be used..but the problem is length is not fixed.
I mean that i need to split at ';'.
Is there any FM available which performs the similar task that is performed by wrapper classes in JAVA?
regards,
G@urav.
‎2006 Sep 28 1:02 PM
Hey,
Using SPLIT only will work if you do it on character types, so you should do it first to a char type and then to a non-char.
Hope this helps
Gabriel P.
‎2006 Sep 28 1:05 PM
data : begin of itab occurs 0,
str type string,
end of itab.
loop at it_char.
split it_char at <delimiter> into table itab.
endloop.now loop at the ne itab and extract ur values
not sure if it can satify ur requirement
‎2006 Sep 28 1:28 PM
Hi Chandrashekhar,
Thanks, i think this will solve my problem.
Regards,
G@urav.
‎2006 Sep 28 1:25 PM
Hi,
REPORT demo_mod_tech_fb_string_split.
DATA: text(10) TYPE c VALUE '0123456789',
text1(6) TYPE c,
text2(6) TYPE c.
PARAMETERS position TYPE i.
CALL FUNCTION 'STRING_SPLIT_AT_POSITION'
EXPORTING
string = text
pos = position
IMPORTING
string1 = text1
string2 = text2
EXCEPTIONS
string1_too_small = 1
string2_too_small = 2
pos_not_valid = 3
OTHERS = 4.Regards
Sudheer