‎2010 Sep 30 8:51 PM
Hi Gurus,
I would like to pull the value of string from ZST to ZLP in the given example ....
ZSTB2L10ZLPZLSZGC*
i.e B2L10
Please advise me your logic.....
Thanks
Ganesh Reddy.
‎2010 Sep 30 10:23 PM
Hi
supposing it starts always with 'ZST'
DATA: lv_string TYPE String VALUE 'ZSTB2L10ZLP*ZLS*ZGC*'.
DATA: mlen TYPE i.
FIND REGEX '.*(?=ZLP)' IN lv_string MATCH LENGTH mlen.
SUBTRACT 3 FROM mlen.
WRITE lv_string+3(mlen).This is more general, it gets the substring everywhere
DATA: lv_string TYPE String VALUE 'AZSTB2L10ZLP*ZLS*ZGC*'.
DATA: moff TYPE i,
mlen TYPE i.
FIND REGEX '(?=ZST).*(?=ZLP)' IN lv_string MATCH OFFSET moff MATCH LENGTH mlen.
ADD 3 TO moff.
SUBTRACT 3 FROM mlen.
WRITE lv_string+moff(mlen).Regards,
Ivan
‎2010 Sep 30 8:57 PM
data: lv_string type string.
data: lv_res type char10.
data: lv_var1 type char10,
data: lv_var2 type char10.
lv_string = ZSTB2L10ZLP*ZLS*ZGC*
split lv_string at 'ZST' into lv_var1 lv_var2.
split lv_var2 at 'ZLP' into lv_res lv_var1.
write: lv_res.
-- Why don't you try some ting like above..
--Naveen Inuganti.
‎2010 Oct 01 12:47 PM
Hi Naveen,
Thanks for your quick reply,
Instead of your are taking value into the variable can we read directly from the table.
Table : ZPERFORM
Fielld : AUT_KEY
AUT_KEY contains all values i.e ZSTB2L10ZLPZLSZGC*.
Please could you give me the logic
Thanks
Ganesh Reddy.
‎2010 Oct 01 2:49 PM
‎2010 Sep 30 10:23 PM
Hi
supposing it starts always with 'ZST'
DATA: lv_string TYPE String VALUE 'ZSTB2L10ZLP*ZLS*ZGC*'.
DATA: mlen TYPE i.
FIND REGEX '.*(?=ZLP)' IN lv_string MATCH LENGTH mlen.
SUBTRACT 3 FROM mlen.
WRITE lv_string+3(mlen).This is more general, it gets the substring everywhere
DATA: lv_string TYPE String VALUE 'AZSTB2L10ZLP*ZLS*ZGC*'.
DATA: moff TYPE i,
mlen TYPE i.
FIND REGEX '(?=ZST).*(?=ZLP)' IN lv_string MATCH OFFSET moff MATCH LENGTH mlen.
ADD 3 TO moff.
SUBTRACT 3 FROM mlen.
WRITE lv_string+moff(mlen).Regards,
Ivan