‎2007 Jul 16 6:44 AM
Hi,
I have an input file in which I get the date as 'mm/d/yyyy' eg: 12/31/9999
Now I need to process records from this file in SAP wrt the date.
Can anyone kindly advice how do I convert 'mm/dd/yyyy' to 'yyyymmdd' - sy-datum format?
Kindly treat this as an urgent requirement.
Thanks.
‎2007 Jul 16 6:49 AM
Hi Anand,
Date/Month Related Function Modules:
DATE_CONV_EXT_TO_INT - user formatted date is converted to system date
RP_CALC_DATE_IN_INTERNAL add/subtract year/month/days from a date
reward pts if found usefull:)
Regards
Sathish
‎2007 Jul 16 6:48 AM
Hi,
Use FM CONVERSION_EXIT_IDATE_INPUT or CONVERT_DATE_TO_INTERNAL for ur requirement.
Regards,
Himanshu
‎2007 Jul 16 6:49 AM
Hi Anand,
Date/Month Related Function Modules:
DATE_CONV_EXT_TO_INT - user formatted date is converted to system date
RP_CALC_DATE_IN_INTERNAL add/subtract year/month/days from a date
reward pts if found usefull:)
Regards
Sathish
‎2007 Jul 16 6:50 AM
Hi
You can offset the entered data field into day,month and year separately like
your entered data is MMDDYYYY
month = date+0(2)
day = date+2(2)
year = date+4(4).
Now concatenate year month day into date1.
display the date1 in th report
<b>Reward points for useful Answers</b>
Regards
Anji
‎2007 Jul 16 6:50 AM
Hi,
Chk this.
data : out_date(10) like char,
in_date(10) like char.
in_date = '10.02.2007'.
*take variables V1, V2, V3.
V1 = in_date+ 0(4).
V2 = in_date+ 5(2).
V3 = in_date+ 7(2).
Concatenate V1 V2 V3 into date separated by '/'.
Now, out_date will have DD/MM/YYYY
Otherwise,Use FM <b>CONVERSION_EXIT_PDATE_OUTPUT</b>
Regards,
Padmam.
‎2007 Jul 16 6:52 AM
In this code you can interchange the location of the year,day and month fields as required.
DATA: date LIKE sy-datum,
changedate(10) TYPE c.
DATA: BEGIN OF it_date1, " To accept date into a internal table
yyyy(4),
mm(2),
dd(2),
END OF it_date1.
DATA: BEGIN OF it_date2, " Internal table for dd/mm/yyyy format
dd(2),
mm(2),
yyyy(4),
END OF it_date2.
DATA: BEGIN OF it_date3, " Internal table for mm/dd/yyyy format
mm(2),
dd(2),
yyyy(4),
END OF it_date3.
date = sy-datum.
it_date1 = date.
MOVE-CORRESPONDING it_date1 TO: it_date2,it_date3.
WRITE it_date2 TO changedate USING EDIT MASK '__/__/____'. " dd/mm/yyyy
WRITE:/ 'Date in dd/mm/yyyy format',
/ changedate.
SKIP.
CLEAR changedate.
WRITE it_date3 TO changedate USING EDIT MASK '__/__/____'. " mm/dd/yyyy
WRITE:/ 'Date in mm/dd/yyyy format',
/ changedate.
Reward if helpful.
Cheers,
Sharadendu
‎2007 Jul 16 7:02 AM
DATA t_date TYPE FIST-SEARCHW.
move date to t_date.
CALL FUNCTION 'SF_SPECIALCHAR_DELETE'
EXPORTING
WITH_SPECIALCHAR = T_DATE
IMPORTING
WITHOUT_SPECIALCHAR = T_DATE
EXCEPTIONS
RESULT_WORD_EMPTY = 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.
*now t_date will have '12319999'
concatenate t_date+4(4) t_date(4) into t_date.
move t_date to date.
*now date will have '99991231'.