2006 Dec 01 5:09 PM
i have declared the date and time fields as date(12) and time(15) in an internal table . The data is coming from a file with some comma separater then i am splitting the data based on comma and storing them in date and time fields internal table first and then update my custome table with the internal table . I have declared the fields in the custom table as dats and tims. The data in the internal table is fine but i cant update it properly to the custom table.I appreciate your immediate response.
2006 Dec 01 7:02 PM
Hi,
use the FM CONVERT_DATE_TO_INTERNAL
Check this example
DATA: v_date TYPE sydatum.
CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
EXPORTING
date_external = '6/1/2006'
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: / v_date.
CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
EXPORTING
date_external = '10/1/2006'
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: / v_date.
Thanks,
Naren
Hi,
use the FM CONVERT_DATE_TO_INTERNAL
Check this example
DATA: v_date TYPE sydatum.
CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
EXPORTING
date_external = '6/1/2006'
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: / v_date.
CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
EXPORTING
date_external = '10/1/2006'
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: / v_date.
Thanks,
Naren
2006 Dec 01 5:14 PM
2006 Dec 01 5:38 PM
2006 Dec 01 6:59 PM
file data will be like 6/1/2006 or 10/1/2006 . I mean day and month length can be 1 or 2.
2006 Dec 01 7:00 PM
2006 Dec 01 7:02 PM
Hi,
use the FM CONVERT_DATE_TO_INTERNAL
Check this example
DATA: v_date TYPE sydatum.
CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
EXPORTING
date_external = '6/1/2006'
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: / v_date.
CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
EXPORTING
date_external = '10/1/2006'
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: / v_date.
Thanks,
Naren
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |