05-03-2006 2:29 AM
Hi,
i'm having problem in retreiving the date from a string where string always Contains pattern of some data followed by previously sored by mm/dd/yyyy like below:
<b>$5,000 w/o PO, $5,000 w/PO. $5,000 Purchase Req: $500
Previously stored text 4/19/2006 Yallas1
Testing for second version
Previously stored text 04/19/2006 EARNENK1 </b>
this is to keep track of the changes, when it is changed and user who made the changes. so from this string i need to take the date and compare it with the date given in the select option date, if it matches, then display the data, for the above example
$5,000 w/o PO, $5,000 w/PO. $5,000 Purchase Req: $500
Testing for second version.
so can you sen me the sample code.
waiting for the reply,
priya
05-03-2006 3:03 AM
Hi, cek this sample code.
[code]
REPORT Z_JRQ015R NO STANDARD PAGE HEADING .
*----
D.A.T.A.
*----
DATA: STR TYPE STRING,
LDATE(10) TYPE C,
POS TYPE I,
LEN TYPE I.
*----
S.E.L.L.E.C.T.I.O.N. .S.C.R.E.E.N.
*----
PARAMETERS P_DATE TYPE SY-DATUM.
*----
I.N.I.T.I.A.L.I.Z.A.T.I.O.N.
*----
INITIALIZATION.
CONCATENATE
'$5,000 w/o PO, $5,000 w/PO. $5,000 Purchase Req: $500'
'Previously stored text 04/19/2006 Yallas1 '
'Testing for second version'
'Previously stored text 04/19/2006 EARNENK1'
INTO STR SEPARATED BY SPACE.
*----
M.A.I.N. .P.R.O.G.R.A.M.
*----
START-OF-SELECTION.
CONCATENATE P_DATE4(2) P_DATE6(2) P_DATE(4)
INTO LDATE SEPARATED BY '/'.
CONCATENATE 'Previously stored text' LDATE
INTO LDATE SEPARATED BY SPACE.
FIND LDATE IN STR MATCH OFFSET POS MATCH LENGTH LEN.
IF SY-SUBRC = 0.
WRITE STR(POS).
ENDIF.
[/code]
*----
Just fill P_Date with '19.04.2006' and tou will see the result.
Regards,
05-03-2006 3:36 AM
Will the date always be in the format N/NN/NNNN or NN/NN/NNNN?
You could search for the first occurence of '/' then check to see if there is another '/' two characters beyond that. Finally check to see if 1 or two characters before the first '/' is numeric; 4 characters after the second '/' are numeric and that there are exactly two numeric characters between them.
Rob
05-03-2006 5:08 AM
Hi Rob,
thanks for the quick reply, the Date format will be as per sy-datum, i have to get remaining test into another field (excluding the previously stored by xx.xx.xxxx every time, that is for internal purpose, no need to display) so that if the date(date is selection screen, that is little bit problematic, we have take care of the ranges, unlike parameter) matches, i've to display that text. all the data i'm getting is given by FM 'READ_TEXT'. for a given object number we can get any amount of data, we have to take the data which only fits in that date criteria. hope i am clear this time.
thanks,
Priya