‎2009 Feb 27 1:08 PM
Hello friends,
I have a string variable which stores the value like...
v_build_str = MAT210AS1MAT210AS2MAT210AS3MAT210AS4MAT210AS5MAT210AS6^
I want to process this variable value and want to store data in inter table like...
MAT210AS1
MAT210AS2
MAT210AS3
MAT210AS4
MAT210AS5
MAT210AS6
How can I do this?
Regards,
RH
‎2009 Feb 27 1:14 PM
HI Ronny,
Use SPLIT command and split the variable at cap symbol u have in text.
example..
DATA: str1 TYPE string,
str2 TYPE string,
str3 TYPE string,
itab TYPE TABLE OF string,
text TYPE string.
text = `What a drag it is getting old`.
SPLIT text AT space INTO: str1 str2 str3,
TABLE itab.
‎2009 Feb 27 1:11 PM
HI,
Use
declare you itab with one field of certain length ( u decide how much length u need )
Split variable at 'use your symbol' into table itab.
Please check the syntax.
Regards,
Venkatesh
‎2009 Feb 27 1:12 PM
Hi Ronny,
You can split the string at '^' and store them into a internal table.
Or you can use offset since all of the are of same length,so once you reach that length in offset take that value into a variable and append it to internal table and then append it,.
Much Regards,
Amuktha.
‎2009 Feb 27 1:15 PM
‎2009 Feb 27 1:18 PM
Hi Ronny,
Here you go!
SPLIT <c> AT <del> INTO <c1> ... <cn>.
This is the basic syntax.
Take that whole string as some w_string and some other string like w_str1 w_str2 w_str3 like that.
Now split w_string at ^ into w_str1 w_str2 .
Hope it helps!
Much Regards,
Amuktha.
‎2009 Feb 27 1:38 PM
Hi,
data :
begin of fs,
w_str(20) type c,
end of fs.
data itab like table of fs.
data w_len type i.
w_len = strlen( w_char ).
while w_char+0(w_len) ne ' '.
split w_char at '^' into fs-w_str.
append fs to itab.
clear fs.
endwhile.
loop at itab into fs.
write 😕 fs-w_str.
endloop.
‎2009 Feb 27 1:14 PM
U can write as :
data : begin of itab occurs 0,
field(15),
end of itab.
split v_build_str at '^' into table itab.
‎2009 Feb 27 1:14 PM
HI Ronny,
Use SPLIT command and split the variable at cap symbol u have in text.
example..
DATA: str1 TYPE string,
str2 TYPE string,
str3 TYPE string,
itab TYPE TABLE OF string,
text TYPE string.
text = `What a drag it is getting old`.
SPLIT text AT space INTO: str1 str2 str3,
TABLE itab.
‎2009 Feb 27 1:18 PM
Hi,
data: begin of itab occurs 0,
field(30) type c,
end of itab.
v_build_str = MAT210AS1MAT210AS2MAT210AS3MAT210AS4MAT210AS5MAT210AS6^
split v_buil_str at '^' into table itab.
Loop at itab.
write:/ itab-field.
endloop.
See the output.
Regards,
Venkatesh
‎2009 Feb 27 1:23 PM
Hi,
*First: declare an ITAB of single field length could same or more than that.
DATA: BEGIN OF ITAB OCCURS 10,
FIELD1 TYPE CHAR9,
END OF ITAB.
*Second: split the field at your symbol or special character.
SPLIT V_BUILD_STR AT '^' INTO TABLE ITAB.
*Third: loop your itab to check it wheather the data is coming in proper manner or not.
LOOP AT ITAB.
WRITE:/ ITAB-FIELD1.
ENDLOOP.
Hope this is helpfull
Regards,
Nishant
‎2009 Feb 27 1:27 PM
chk this:
DATA: itab TYPE TABLE OF string,
text TYPE string.
text = 'MAT210AS1MAT210AS2MAT210AS3MAT210AS4MAT210AS5MAT210AS6^'
.
SPLIT text AT '^' INTO:
TABLE itab.
itab will get all the values u need:
MAT210AS1
MAT210AS2
MAT210AS3
MAT210AS4
MAT210AS5
MAT210AS6
‎2009 Mar 03 9:46 AM