‎2006 Oct 04 10:04 AM
Hi Experts,
How can i delete the leading characters in a stirng str.
For example,
I have a string like this:
str = '0016687#ABACDEX.XML'.
So from # i want to delete #0016687..
Ie.result should be ABACDEX.XML'
How can we do this?
Regards
‎2006 Oct 04 10:06 AM
Hi,
You can split the string at '#'.
Example :
<b>Split str at '#' into str1 and str2.</b>
The str1 will have values before the '#' and str2 the remaining part after the '#' symbol.
Hope this helps.
‎2006 Oct 04 10:06 AM
hi,
try this.
SEARCH str1 FOR '#'.
str2 = str1+SY-FDPOS.
write str2.
rgds
anver
if hlped mark points
Message was edited by: Anversha s
‎2006 Oct 04 10:08 AM
1)
data: v_new type string,
dummy type string.
split v_str at '#' into dummy V_new .
v_new would have the result.
REgards,
Ravi
‎2006 Oct 04 10:08 AM
Hi,
Use below code
l1 = strlen(tr)
search tr for '#'.
if sy-subrc = 0.
v1 = tr+sy-fdpos(l1)
endif.
Now V1 has ABACDEX.XML'
Mark useful answers.
Regards
Divakar
‎2006 Oct 04 10:10 AM
REPORT ztest_alv5.
data : v_str type string value '0016687#ABACDEX.XML',
v_str1 type string,
v_location TYPE I.
if v_str ca '#'.
v_location = sy-fdpos + 1.
v_str1 = v_str+v_location.
endif.
write 😕 v_str, v_str1.
‎2006 Oct 04 11:03 AM
Hi Experts,
See the following code.and try to give some suggession.
DATA : I_FILES LIKE SPFLIST OCCURS 0 WITH HEADER LINE,
DATA: W_FILES LIKE LINE OF I_FILES.
sTR(200) TYPE C,
STR1(200) TYPE C,
STR2(200) TYPE C.
loop at i_files into w_files.
STR = W_FILES-LINE.
SPLIT STR AT '#' INTO STR1 STR2.
W_FILES-LINE = STR2.
MODIFY i_files FROM W_FILES.
endloop.
SUPPOSE I_FILES CONTAINS LIKE THIS:
1 00000000000#. 2 00000000000#..
3 00000003379#212RegVNegNoticeHLA.aspx.xml 4 00000006934#ABA_Compliance_Audit_Manual.aspx.xml
sO IN DEBUGGING WHEN I SEE THE CONTENTS OF STR2. IT IS EMPTY.BUT STR AND STR1 CONTAINS FULL STRING.
IE. FOR EXAMPLE AFTER SPLIT COMMAND STR AND STR1 CONTAINS '00000003379#212RegVNegNoticeHLA.aspx.xml'.
And STR2 is EMPTY.
wHAT MAY BE THE REASON?
‎2006 Oct 04 11:06 AM
hi,
try this.
loop at i_files into w_files.
str1 = W_FILES-LINE.
<b>SEARCH str1 FOR '#'.
clear W_FILES-LINE.
W_FILES-LINE = str1 + SY-FDPOS.</b>
MODIFY i_files FROM W_FILES.
endloop.
rgds
anver
if hlped mark points
‎2006 Oct 04 11:11 AM
chk this ,it works good in my system
REPORT YCHATEST.
DATA : I_FILES LIKE SPFLIST OCCURS 0 WITH HEADER LINE.
DATA: W_FILES LIKE LINE OF I_FILES,
STR(200) TYPE C,
STR1(200) TYPE C,
STR2(200) TYPE C.
I_FILES-LINE = '00000003379#212REGVNEGNOTICEHLA.ASPX.XML'.
APPEND I_FILES.
CLEAR I_FILES.
LOOP AT I_FILES INTO W_FILES.
STR = W_FILES-LINE.
SPLIT STR AT '#' INTO STR1 STR2.
W_FILES-LINE = STR2.
MODIFY I_FILES FROM W_FILES.
WRITE W_FILES-LINE.
ENDLOOP.
‎2006 Oct 04 10:10 AM
The best way is to split the string
data : vstr type string,
vnstr type string,
vdum type string.
split vstr at '#' into vdum vnstr.
Vnstr is the string with required data.
‎2006 Oct 04 10:13 AM
REPORT YCHATEST.
DATA : STR TYPE STRING,
STR1 TYPE STRING..
STR = '0016687#ABACDEX.XML'.
SPLIT STR AT '#' INTO STR1 STR.
WRITE : STR.Any difference between my reply and vasanths reply??
‎2006 Oct 04 10:15 AM
Hello Ravi,
Use split command for ur requrient.
DATA: STR1 TYPE STRING,
STR2 TYPE STRING.
SPLIT STR AT '#' INTO STR1 STR2.
Now the STR2 will have ABACDEX.XML.
if useful reward.
Vasanth
‎2006 Oct 04 10:28 AM
‎2006 Oct 04 10:48 AM
Hi,
replace '0016687#' with ' ' into str.
condense str.
or
split str at '#' into a b.
b will have ABACDEX.XML'
Regards
amole