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

validation on data and time format

Former Member
0 Likes
2,577

Hi

In a flat file a date and time fill in but user. And the data and time format should always be fill in with the format <DDMMYYYY> <HHMMSS>

is there a FM which check whether user has put the wrong date format such as <YYYYMMDD> or <MMDDYYYY> instead for the the one mention above.

Please advise whether there is a FM which check on the format on the time stamp also.

Note: the input of the data and time is done by the user.

Thank

7 REPLIES 7
Read only

anversha_s
Active Contributor
0 Likes
1,307

Hi,

Please refer this thread. A similar issue is solved there.

https://forums.sdn.sap.com/click.jspa?searchID=20622434&messageID=6703772

Regards,

Anversha

Read only

0 Likes
1,307

DO you know any FM which check the time format

Read only

Former Member
0 Likes
1,307

Hi,

Use this FM, If user enter the wrong format , this FM convert it into correct internal format

CONVERT_DATE_TO_INTERNAL

Read only

Former Member
0 Likes
1,307

hi

you can use this fm DATE_CHECK_PLAUSIBILITY and CONVERT_DATE_INPUT

hope this helps

regards

Aakash Banga

Read only

Former Member
0 Likes
1,307

Hi,

use the new OOPs concept,


PARAMETERS dateTYPE c LENGTH 10.

DATA matcher TYPE REF TO cl_abap_matcher.
* For date
matcher = cl_abap_matcher=>create( pattern = `[0-9]{1,2}/[0-9]{1,2}/[0-9]{2,4}`
                                   ignore_case = 'X'
                                   text = date ).
IF matcher->match( ) IS INITIAL.
  MESSAGE 'Wrong Format' TYPE 'I'.
ELSE.
  MESSAGE 'Format OK' TYPE 'I'.
ENDIF.

like dis pattern for time :


[0-9]{1,2}:[0-9]{2}

pattern for timestamp:


[0-9]{1,2}/[0-9]{1,2}/[0-9]{2,4} [0-9]{1,2}:[0-9]{2}

Code Formatted by: Alvaro Tejada Galindo on Jan 7, 2009 4:35 PM

Read only

0 Likes
1,307

hi i am not familiar with the OO concept could you just please explain to met a little bit

Read only

Former Member
0 Likes
1,307

Hi,

For knowing more about OO- ABAP u cam search for detailed documentation and it wll take time to grasp...

for ur requirement normally RegEx ;ie regular expressions are used...which is now replaced with calss based search and find patterns...

for inf abt that see the Regular Expressions topic in the below ppt....

http://www.adfahrer.com/workplace/sem/2006-11-28-adsig-sbn-walldorfabap/horstkeller-cd200-sent-in.pd...