‎2009 Jun 15 10:44 PM
Hello,
I have a string as follows:
C:\Documents and Settings\USER\Desktop\01.XML
I want to split this string as follows:
a) C:\Documents and Settings\USER\Desktop
b) 01.XML
Regards,
Jainam.
‎2009 Jun 15 11:03 PM
DATA : v_ch TYPE string VALUE 'C:\Documents and Settings\USER\Desktop\01.XML',
v_ch1 TYPE string,
v_ch2 TYPE string,
v_length TYPE i,
file TYPE i.
SPLIT v_ch AT '.XML' INTO v_ch1 v_ch2.
v_length = strlen( V_CH1 ).
DO .
v_length = v_length - 1.
IF v_ch1+v_length(1) = '\'.
v_length = v_length + 1.
WRITE v_ch1+v_length(file).
EXIT.
ENDIF.
file = file + 1.
ENDDO.
‎2009 Jun 15 11:03 PM
DATA : v_ch TYPE string VALUE 'C:\Documents and Settings\USER\Desktop\01.XML',
v_ch1 TYPE string,
v_ch2 TYPE string,
v_length TYPE i,
file TYPE i.
SPLIT v_ch AT '.XML' INTO v_ch1 v_ch2.
v_length = strlen( V_CH1 ).
DO .
v_length = v_length - 1.
IF v_ch1+v_length(1) = '\'.
v_length = v_length + 1.
WRITE v_ch1+v_length(file).
EXIT.
ENDIF.
file = file + 1.
ENDDO.
‎2009 Jun 15 11:12 PM
Hi,
Hope following code will be helpful.
data: v_string type string value 'C:\Documents and Settings\USER\Desktop\01.XML',
v_string1(200) type c,
v_string2(200) type c,
v_len type i.
v_len = strlen( v_string ).
while v_len > 1.
v_len = v_len - 1.
v_string2+v_len(1) = v_string+v_len(1).
if v_string+v_len(1) = '\'.
clear v_string2+v_len(1).
v_string1 = v_string+0(v_len).
exit.
endif.
endwhile.
condense v_string2.
write:/2 v_string1,
/2 v_string2.
Cheers,
Vikram
‎2009 Jun 15 11:17 PM
Jainam,
i guess u are extracting file name and directory names from the string. are u sure that u will have this partern of string only? then only the above codes do work i think...
‎2009 Jun 16 4:02 AM
Hi,
Use Find with Results tab, Take the last offset position and split there.
See F1 help for FIND...RESULTS
Regards
Karthik D
‎2009 Jun 16 4:08 AM
‎2009 Jun 16 4:20 AM
Hi,
Use the FM 'CV120_SPLIT_PATH'...
or,
FM 'DSVAS_DOC_FILENAME_SPLIT'
This will solve your problem..
‎2009 Jun 16 4:35 AM
Hi, Shah
Please Search Before Posting this Question has asked and answered so many times
You have got Lot of help here to So Please Close this Thread Now
Regards,
Faisal
‎2009 Jun 16 5:48 AM
data:
val(250),
result1 like val,
result2 like val,
my_index type i.
data:
begin of itab occurs 0,
val like val,
end of itab.
val = 'C:\Documents and Settings\USER\Desktop\01.XML'.
split val at '\' into table itab.
describe table itab lines my_index.
read table itab index my_index.
if sy-subrc eq 0.
result2 = itab-val.
delete itab index my_index.
loop at itab.
concatenate result1 itab-val '\' into result1.
endloop.
write: RESULT1,/ RESULT2.
endif.
‎2009 Jun 16 5:52 AM
Hi,
Try using function module:
SO_SPLIT_FILE_AND_PATH
Hope it helps
Regards
Mansi