‎2006 Apr 19 5:14 AM
Hi
I have a date which could be either 01.01.2006 or even 1.1.2006. Whenever the date appears as 1.1.2006, i need it to be converted to the format 01.01.2006. Can anyone providde me with the logic or is any FM available for this ?
Murali.
‎2006 Apr 19 5:20 AM
Hi Murali,
There is a FM for this purpose.
It is CONVERT_DATE_INPUT.
Just check this code.
parameters: a(12).
data: b type sy-datum.
CALL FUNCTION 'CONVERT_DATE_INPUT'
EXPORTING
input = a
PLAUSIBILITY_CHECK = 'X'
IMPORTING
OUTPUT = b
EXCEPTIONS
PLAUSIBILITY_CHECK_FAILED = 1
WRONG_FORMAT_IN_INPUT = 2
OTHERS = 3
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
This will convert 1.1.2006 to 01.01.2006.
Hope your query is solved.
Regards,
SP.
‎2006 Apr 19 5:20 AM
Hi Murali,
There is a FM for this purpose.
It is CONVERT_DATE_INPUT.
Just check this code.
parameters: a(12).
data: b type sy-datum.
CALL FUNCTION 'CONVERT_DATE_INPUT'
EXPORTING
input = a
PLAUSIBILITY_CHECK = 'X'
IMPORTING
OUTPUT = b
EXCEPTIONS
PLAUSIBILITY_CHECK_FAILED = 1
WRONG_FORMAT_IN_INPUT = 2
OTHERS = 3
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
This will convert 1.1.2006 to 01.01.2006.
Hope your query is solved.
Regards,
SP.
‎2006 Apr 19 5:23 AM
hi
good
The field TCURR-GDATU is subject to a conversion routine INVDT
look at the CONVERSION_EXIT_INVDT_INPUT and
CONVERSION_EXIT_INVDT_OUTPUT function modules. Basically it converts the date to 8 characters.
DATUMSAUFBEREITUNG Country-specific date formatting
DAYS_BETWEEN_TWO_DATES
Number of days is returned in the E_TAGE parameter
thanks
mrutyun