2006 Sep 27 4:51 AM
I am getting a date it MMDDYY format, want to check if it is in the right format and then change to normal format. is there any FM for this?
point will be rewarded
2006 Sep 27 5:09 AM
Hi,
Check this...
DATA: v_char(6).
v_char = '121706'.
DATA: v_date TYPE sydatum.
v_date+4(2) = v_char(2).
v_date6(2) = v_char2(2).
CONCATENATE '20' v_char+4(2) INTO v_date(4).
CALL FUNCTION 'DATE_CHECK_PLAUSIBILITY'
EXPORTING
date = v_date
EXCEPTIONS
plausibility_check_failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
WRITE: / 'INvalid date'.
ELSE.
WRITE: / 'Correct date'.
ENDIF.
Thanks,
Naren
I am getting a date it MMDDYY format, want to check if it is in the right format and then change to normal format. is there any FM for this?
point will be rewarded
2006 Sep 27 4:55 AM
2006 Sep 27 4:55 AM
2006 Sep 27 5:09 AM
Hi,
Check this...
DATA: v_char(6).
v_char = '121706'.
DATA: v_date TYPE sydatum.
v_date+4(2) = v_char(2).
v_date6(2) = v_char2(2).
CONCATENATE '20' v_char+4(2) INTO v_date(4).
CALL FUNCTION 'DATE_CHECK_PLAUSIBILITY'
EXPORTING
date = v_date
EXCEPTIONS
plausibility_check_failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
WRITE: / 'INvalid date'.
ELSE.
WRITE: / 'Correct date'.
ENDIF.
Thanks,
Naren
| User | Count |
|---|---|
| 6 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |