09-12-2007 6:30 AM
hi abapers,
when i am entering the input value in parameter the value of the output is entirely different.it just split the date without convert the date. help me please.
thank you.
PARAMETERS:P TYPE D.
DATA:DATS LIKE SY-DATUM.
CALL FUNCTION 'CONVERT_DATE_TO_INTERN_FORMAT'
EXPORTING
datum = p
dtype = DATS
IMPORTING
ERROR =
IDATE =
MESSG =
MSGLN =
.
write (10) P USING EDIT MASK '____/__/__'.
09-12-2007 6:36 AM
use the fm:
CONVERT_DATE_TO_INTERN_FORMAT
SAMPLE USAGE:
call function 'CONVERT_DATE_TO_INTERN_FORMAT'
exporting datum = '12/12/2006'
dtype = 'DATS'
importing idate = v_date. "v_date should be of type sy-datum or chracter field of length 8
09-12-2007 6:36 AM
enter your date in the format like this:
enter the date: 12122007
output will be : 12/12/2007
copy and paste the following code.
i have changed the last line..read it carefully..
Reward points if helpful...
PARAMETERS:P TYPE D.
DATA:DATS LIKE SY-DATUM.
CALL FUNCTION 'CONVERT_DATE_TO_INTERN_FORMAT'
EXPORTING
datum = p
dtype = DATS
IMPORTING
ERROR =
IDATE =
MESSG =
MSGLN =
.
write (10) P USING EDIT MASK '__/__/____'.
09-12-2007 6:37 AM
Hi,
pls give us ur input date format.
here is a working sample code: '9/2/2003' to 20030209
data : urdate(10) type c,
mydate type d.
*move '9/2/2003' to urdate.
urdate = '9/2/2003'.
CALL FUNCTION 'RP_FORMATING_DATE'
EXPORTING
DATE_I = urdate
* BIRTH_DATE = 'X'
IMPORTING
DATE_O = mydate
* EXCEPTIONS
* DATE_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.
CALL FUNCTION 'CONVERT_DATE_TO_INTERN_FORMAT'
EXPORTING
DATUM = mydate
DTYPE = 'DATS'
IMPORTING
* ERROR =
IDATE = mydate
* MESSG =
* MSGLN =
.
write : mydate.
Hope it was helpful.
Regards,
Anjali
09-12-2007 6:38 AM
Use function module 'CONVERT_DATE_TO_INTERN_FORMAT'
With datum = <date_value>
dtype = 'DATS'.
09-12-2007 6:42 AM
Hi MAnjula,
Now paste this code..
PARAMETERS:P TYPE D.
DATA:DATS LIKE SY-DATUM,
<b> date type d.</b>
CALL FUNCTION 'CONVERT_DATE_TO_INTERN_FORMAT'
EXPORTING
datum = p
dtype = DATS
<b> IMPORTING</b>
ERROR =
<b> IDATE = date</b>
MESSG =
MSGLN =
.
write (10) date using EDIT MASK '____/__/__'.
09-12-2007 6:43 AM
Hi,
please look at the changes in bold.
PARAMETERS:P TYPE D.
DATA:DATS LIKE SY-DATUM.
<b>
data : idate type DATUV.</b>
CALL FUNCTION 'CONVERT_DATE_TO_INTERN_FORMAT'
EXPORTING
datum = p
dtype = DATS
<b> IMPORTING</b>
ERROR =
<b>IDATE = idate</b>
MESSG =
MSGLN =
.
write (10) <b>idate</b> USING EDIT MASK '____/__/__'.
rewards if useful,
regards,
nazeer
09-12-2007 7:13 AM
hi abapers,
sorry i thik i didnt explain u properly.for ex.when i am entering the input in parameter as '03/03/2007'.the output is '0303/20/07'.this is a wrong answer.
i want 2007/03/03.help me please.
09-12-2007 7:02 AM
hi abapers,
sorry i thik i didnt explain u properly.for ex.when i am entering the input in parameter as '03/03/2007'.the output is '0303/20/07'.this is a wrong answer.
i want 2007/03/03.help me please.