10-16-2008 9:47 AM
How can a create a default date from SY-datum that will give a date with a format like YYYYMMDD?
Edited by: Alvin Rosales on Oct 16, 2008 10:47 AM
10-16-2008 9:50 AM
Hi Alvin
Try this code
DATA : DATE TYPE CHAR10.
CALL FUNCTION 'FORMAT_DATE_4_OUTPUT'
EXPORTING
DATIN = SY-DATUM
FORMAT = 'YYYYMMDD'
IMPORTING
DATEX = DATE
.
WRITE : / DATE.
Regards
10-16-2008 9:48 AM
Hi,
Use FM CONVERT_DATE_TO_INTERN_FORMAT --> Convert ddmmyyyy to yyyymmdd
Regards,
Sandeep
10-16-2008 9:50 AM
Hi Alvin
Try this code
DATA : DATE TYPE CHAR10.
CALL FUNCTION 'FORMAT_DATE_4_OUTPUT'
EXPORTING
DATIN = SY-DATUM
FORMAT = 'YYYYMMDD'
IMPORTING
DATEX = DATE
.
WRITE : / DATE.
Regards
10-16-2008 10:03 AM
10-16-2008 10:10 AM
Hi,
I did not understand your question properly. But if you want to put default date try this.
PARAMETERS : P_DATE TYPE CHAR20 DEFAULT SY-DATUM.
Regards
10-16-2008 10:11 AM
Hi,
Yes u can make this date as default under INITIALIZATION event.
Regards,
Sandeep
10-16-2008 10:14 AM
10-16-2008 10:10 AM
I don't understand what is the problem here... sy-datum has actually format like YYYYMMDD
10-16-2008 10:21 AM
CALL FUNCTION 'FORMAT_DATE_4_OUTPUT'
EXPORTING
datin = sy-datum
format = 'YYYYMMDD'
IMPORTING
datex = v_date.
this is a goood answer but i cant place the v_date into the parameters at selection screen, the value of vdate doesnt appear in the selection screen
10-16-2008 10:23 AM
>
> CALL FUNCTION 'FORMAT_DATE_4_OUTPUT'
> EXPORTING
> datin = sy-datum
> format = 'YYYYMMDD'
> IMPORTING
> datex = v_date.
>
> this is a goood answer but i cant place the v_date into the parameters at selection screen, the value of vdate doesnt appear in the selection screen
actually the above code does not change anything, just waste of time (told already that the format of sy-datum is YYYYMMDD), you only need:
PARAMETERS : p_date TYPE sy-datum DEFAULT sy-datum.
10-16-2008 10:23 AM
Hi Alvin,
I think this solves the problem right?
PARAMETERS : P_DATE TYPE CHAR20 DEFAULT SY-DATUM.
Have you tried it ?
Regards
Edited by: Rajvansh Ravi on Oct 16, 2008 11:24 AM
10-16-2008 10:21 AM
Hi, Alvin, i just want to say format of sy-datum is yyyymmdd if you do not use the statement 'Write' to output.
10-16-2008 10:24 AM
10-16-2008 10:27 AM
hi this will work ..
parameters : ss(8) type c .
initialization.
CALL FUNCTION 'CONVERT_DATE_TO_INTERN_FORMAT'
EXPORTING
datum = sy-datum
dtype = 'YYYYDDMM'
IMPORTING
ERROR =
IDATE = ss.
MESSG =
MSGLN =
YOU CAN USE ANOTHER OPTION.
parameters : ss(8) type c default sy-datum.
Edited by: swati gupta on Oct 16, 2008 11:29 AM
10-16-2008 10:35 AM