2005 Nov 03 7:22 PM
Hi,
I have a field of type SY-DATUM and I am loading data from an external system into BW. The field should be of the format YYYYMMDD (Ex: 20051025). But I have some corrupt data where the field is not in the specified format. Sometimes the date is in othe formats, for example 05/02/054, 20/04/04 and some other formats.
Well, When the field is not in the correct format, I would like to set the field to NULL. Any ideas appreciated.
Thanks
GOva
2005 Nov 03 7:33 PM
Sure, you can check the plausibility of the date.
If the data coming in is not of the correct format for SAP, then you set to initial..
Check out this sample program.
report zrich_0001 .
data: p_date type sy-datum value '65/1/2545'.
call function 'DATE_CHECK_PLAUSIBILITY'
exporting
date = p_date
exceptions
plausibility_check_failed = 1
others = 2.
if sy-subrc = 1.
write:/ 'This date is not a real date'.
else.
write:/ 'Looks ok to me'.
endif.
p_Date = sy-datum.
call function 'DATE_CHECK_PLAUSIBILITY'
exporting
date = p_date
exceptions
plausibility_check_failed = 1
others = 2.
if sy-subrc = 1.
write:/ 'This date is not a real date'.
else.
write:/ 'Looks ok to me'.
endif.
Regards,
RIch HEilman
Hi,
I have a field of type SY-DATUM and I am loading data from an external system into BW. The field should be of the format YYYYMMDD (Ex: 20051025). But I have some corrupt data where the field is not in the specified format. Sometimes the date is in othe formats, for example 05/02/054, 20/04/04 and some other formats.
Well, When the field is not in the correct format, I would like to set the field to NULL. Any ideas appreciated.
Thanks
GOva
2005 Nov 03 7:33 PM
Sure, you can check the plausibility of the date.
If the data coming in is not of the correct format for SAP, then you set to initial..
Check out this sample program.
report zrich_0001 .
data: p_date type sy-datum value '65/1/2545'.
call function 'DATE_CHECK_PLAUSIBILITY'
exporting
date = p_date
exceptions
plausibility_check_failed = 1
others = 2.
if sy-subrc = 1.
write:/ 'This date is not a real date'.
else.
write:/ 'Looks ok to me'.
endif.
p_Date = sy-datum.
call function 'DATE_CHECK_PLAUSIBILITY'
exporting
date = p_date
exceptions
plausibility_check_failed = 1
others = 2.
if sy-subrc = 1.
write:/ 'This date is not a real date'.
else.
write:/ 'Looks ok to me'.
endif.
Regards,
RIch HEilman
2005 Nov 03 8:36 PM
2005 Nov 03 8:40 PM
2005 Nov 03 8:45 PM
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |