Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Date search

IanStubbings
Active Participant
0 Likes
482

Hi

I need to search for a date range in the format DD.MM.YYYY-DD.MM.YYYY in some text such as:

Electricity Charges on 12.11.2001 to 12.12.2001.

How would I extract that date range without using offsets as the date range could equally be like this:

12.11.2001 to 12.12.2001 Electricity Charges.

I am thinking of using regular expressions. Would this be the right way to go? I have never used them before are they simple to use?

Cheers

Ian

1 ACCEPTED SOLUTION
Read only

MarcinPciak
Active Contributor
0 Likes
450

Hi,

Try to use this logic:

data: txt type string value 'Electricity Charges 01.07.2008 to 01.07.2008'.

data: date_to_search(10) type c,
        date type d.

write sy-datum to date_to_search using EDIT MASK 'LL__.__.____'.

if txt cs date_to_search.
  write: 'Success'.
else.
  write: 'Failure'.
endif.

regards,

Marcin

Hi

I need to search for a date range in the format DD.MM.YYYY-DD.MM.YYYY in some text such as:

Electricity Charges on 12.11.2001 to 12.12.2001.

How would I extract that date range without using offsets as the date range could equally be like this:

12.11.2001 to 12.12.2001 Electricity Charges.

I am thinking of using regular expressions. Would this be the right way to go? I have never used them before are they simple to use?

Cheers

Ian

3 REPLIES 3
Read only

Former Member
0 Likes
450

Ian,

just press F1 on SEARCH in se38.you will get help.

Amit.

Read only

MarcinPciak
Active Contributor
0 Likes
451

Hi,

Try to use this logic:

data: txt type string value 'Electricity Charges 01.07.2008 to 01.07.2008'.

data: date_to_search(10) type c,
        date type d.

write sy-datum to date_to_search using EDIT MASK 'LL__.__.____'.

if txt cs date_to_search.
  write: 'Success'.
else.
  write: 'Failure'.
endif.

regards,

Marcin

Read only

0 Likes
450

As it happens I've solved it myself but thank you for your help.-

FIND REGEX '(0[1-9]|[12][0-9]|3[01])[- /.](0[1-9]|1[012])[- /.](19|20)\d\d'

IN ls_open_items-sgtxt

MATCH OFFSET lv_offset.

Cheers

Ian