‎2006 Oct 05 5:39 PM
Hi,
I am getting date in the format as detailed below:
10/16/2005, 6/16/2005, 10/6/2005 - MM/DD/YYYY
I have to convert it to the internal date format.
Please help with the code.
Thanks
SAPBW
‎2006 Oct 05 5:45 PM
Hi,
Use the function module CONVERT_DATE_TO_INTERNAL..
CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
EXPORTING
DATE_EXTERNAL = V_DATE_EX
IMPORTING
DATE_INTERNAL = V_DATE.
Thanks,
Naren
‎2006 Oct 05 5:45 PM
Hi,
Use the function module CONVERT_DATE_TO_INTERNAL..
CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
EXPORTING
DATE_EXTERNAL = V_DATE_EX
IMPORTING
DATE_INTERNAL = V_DATE.
Thanks,
Naren
‎2006 Oct 05 5:45 PM
HI,
Use Function module <b>CONVERT_DATE_TO_INTERNAL</b>
CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
EXPORTING
DATE_EXTERNAL = PL_BUDAT
IMPORTING
DATE_INTERNAL = P_BUDAT
EXCEPTIONS
DATE_EXTERNAL_IS_INVALID = 1
OTHERS = 2.Regards
Sudheer
‎2006 Oct 05 5:55 PM
Hi,
Use Function module <b>CONVERT_DATE_TO_INTERNAL</b>.
It will consider all types of date formats 10/16/2005, 6/16/2005, 10/6/2005 etc. Whether you will give 1 or 2 digits to month or date. You can also give 2 digits to year even then it will converts to internal format.
<b>You need to give dates in User defined format otherwise it generates an exception DATE_EXTERNAL_IS_INVALID.</b>
DATA V_EXT_DATE(10) VALUE '10/06/2005'.
DATA V_DATE TYPE SY-DATUM.
CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
EXPORTING
date_external = V_EXT_DATE
IMPORTING
DATE_INTERNAL = V_DATE
EXCEPTIONS
DATE_EXTERNAL_IS_INVALID = 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.
WRITE:/ 'INTERNAL FORMAT OF DATE IS: ', V_DATE.
Thanks,
Vinay
Thanks,
Vinay
‎2006 Oct 05 5:55 PM
Use the FM <b>/SAPDMC/LSM_DATE_CONVERT</b>.
Pass DATE_IN = 10/16/2005
DATE_FORMAT_IN = DMDY
TO_OUTPUT_FORMAT = BLANK
TO_INTERNAL_FORMAT = X
OUTPUT
DATE_OUT = 20051016
Regards,
Prakash.
‎2023 Aug 16 4:14 PM
cl_abap_datfm=>conv_date_ext_to_int
cl_abap_datfm=>conv_date_ext_to_int(
EXPORTING
im_datext = rv_date " external representation of date
im_datfmdes = iv_pattern " date format provided
IMPORTING
ex_datint = DATA(lv_int_date) " internal representation of datecl_abap_datfm=>conv_date_int_to_ext
cl_abap_datfm=>conv_date_int_to_ext(
EXPORTING
im_datint = CONV d( rv_date ) " internal representation of date
im_datfmdes = iv_pattern " date format wanted for conversion
IMPORTING
ex_datext = rv_date " external representation of date