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 format check

Former Member
0 Likes
3,001

Hi

i want to check the date format how can i?

2007/09/23 like this format or not

9 REPLIES 9
Read only

Former Member
0 Likes
1,191

If it is a report you can put a break-point where ever that field is being poputaled and check in debugger.

Regards,

Himanshu

Read only

Former Member
0 Likes
1,191

Hi

Check the date related fun modules

CONVERT_DATE_TO_INTERNAL

CONVERT_DATE_TO_EXTERNAL

CONVERT_FIELD_TOEXTERN_FORMAT

<b>Reward points for useful Answers</b>

Regards

Anji

Read only

Former Member
0 Likes
1,191

HI,

you can try like this,

first validate the year

date+0(4) should be greater and 1000 and less than 9999

and date+4(1) = '/'.

and date+5(2) should be between 01 and 12

and date+7(1) = '/'.

and date 8(2) should be between 01 and 31.

if any one of these conditions are failed

then your date format is wrong.

reward points if helpful,

thanks & regards,

venkatesh

Read only

former_member189059
Active Contributor
0 Likes
1,191

Hello Ramesh,

Using sub-strings you can check for the position of the '/' character

eg... if field+2(3) = '/'.

Read only

amit_khare
Active Contributor
0 Likes
1,191

Refer the link -

Regards,

Amit

Reward all helpful replies.

Read only

Former Member
0 Likes
1,191

hi



DATA: e_date(10) type c VALUE <b>'02/02/2006',</b>" specify wrong date format here
i_date(10).

CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
EXPORTING
date_external = e_date
IMPORTING
date_internal = i_date
EXCEPTIONS
date_external_is_invalid = 1
OTHERS = 2.


case sy-subrc.

when 0.
WRITE : / 'CONVERT_DATE_TO_INTERNAL',
/ 'My Date:' , e_date ,
'Conv Date:', i_date,
'System Date:', sy-datum.

when 1.
<b>write: 'date_external_is_invalid'.</b>

when 2.
write:' some error occured'.
endcase.

regards

ravish

<b>plz dont forget to reward points if helpful</b>

Read only

Former Member
0 Likes
1,191

HI Ramesh

try like thi s

 data: begin of int_bseg occurs 0,
    BELNR LIKE BSEG-BELNR,
    ZUONR LIKE BSEG-ZUONR,
    GJAHR LIKE BSEG-GJAHR,

end of int_bseg.
start-of-selection.
data: lv_date type sy-datum.
data: lv_date1 type sy-datum.

data: lv_formatdate(10) type c.
data: lv_formatdate1(10) type c.

data: var1(4) type c,

var2(2) type c,

var3(2) type c.


data: 2days_out type sy-datum.


lv_date = 2days_out.
var1 = lv_date+(4).
var2 = lv_date+4(2).
var3 = lv_date+6(2).

concatenate var3 var2 var1 into lv_formatdate separated by '/'.

select zuonr belnr bukrs GJAHR from bseg into
corresponding fields of  table int_bseg
where bukrs = 'company code' and
      ZUONR = lv_formatdate.


Reward all helpfull answers

Regards

Pavan

Read only

Former Member
0 Likes
1,191

Function Module is -><b>DATE_CHECK_PLAUSIBILITY</b> for

Date plausibility check

reward points if it is usefull.

Girish

Read only

Former Member
0 Likes
1,191

Hi,

Use CP (ContainPattern) as below :

<b>if Date CP '//*'.</b>

statement....................

endif.

reward points, if helpful,

sandeep kaushik