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

Checking date format

Former Member
0 Likes
1,953

Hi,

This is my requirement : I have an inbound IDOC in which there is a date field .I need to check within my function module whether the incoming date has the format YYYYMMDD or not .If not then post an error.Also this date must be less than or equal to today's date .If not ,post an error .I wanted to know how we can satisfy both the above conditions

4 REPLIES 4
Read only

Former Member
0 Likes
1,109

hi,

as u will be getting the format of mmddyyyy now using offset take 3 variables and change it.

as follows.

date : 12252008

v_1 = date+0(2).month

v_2 = date+2(2).day

v_3 = date+4(2). year.

concatenate v3 v1 v2 into date1.

this will be survive ur purpose.

Read only

0 Likes
1,109

Hi,

Use :

CALL FUNCTION 'DATE_CHECK_PLAUSIBILITY'

EXPORTING

DATE = DATE

EXCEPTIONS

PLAUSIBILITY_CHECK_FAILED = 1

OTHERS = 2.

Check sy-subrc .

I hope this helps,

Regards

Raju Chitale

Read only

Former Member
0 Likes
1,109

Dear Kunal,

HRGPBS_HESA_DATE_FORMAT

Format a date valid for HESA: DD/MM/YYYY

data:date_form type CHAR10.

call function 'HRGPBS_HESA_DATE_FORMAT'

exporting

P_DATE = sy-datum

importing

DATESTRING = date_form

exceptions

others = 1.

write : date_form.

also check thread..

Regards,

Flavya

Read only

Former Member
0 Likes
1,109

Use this FM DATE_CHECK_PLAUSIBILITY

See this code.

DATA s TYPE d VALUE '20085645' .

CALL FUNCTION 'DATE_CHECK_PLAUSIBILITY'
  EXPORTING
    date                      = s
  EXCEPTIONS
    plausibility_check_failed = 1
    OTHERS                    = 2.
IF sy-subrc <> 0.
  MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
          WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.