09-12-2008 9:19 PM
Hi All,
i am craeting report in ALV grid, in that report i want to dispaly date like 'MM/DD/YYYY'. present its display like YYYYMMDD.
can you give me some idea...
Thanks
zeni
09-12-2008 9:22 PM
09-12-2008 9:24 PM
refer to a date type in the fieldcatalog andthe date will be converted automatically according tothe user settings. dont transformthe date yourself.
09-12-2008 9:54 PM
If you want to use the date type (this is the easiest way and it will be formatted according to the logon default of the master data of the current user):
1. Be sure you are using a proper date type in the output table.
2. Make sure that the following fields of the field catalog contain the following:
LVC_S_FCAT-DATATYPE = 'DATS'.
LVC_S_FCAT-INTTYPE = 'D'.
LVC_S_FCAT-INTLEN = '000008'.
LVC_S_FCAT-DD_OUTLEN = '000010'.
However if you want to have a more generic approach that is independent on the user master data:
Assuming output_tab-external_date is of type C and has 10 digits.
data: date_int type d value '20080808'.
case date_format.
when 'MM/DD/YYYY'.
write date_int to output_tab-external_date MM/DD/YYYY.
when 'MM/DD/YY'.
write date_int to output_tab-external_date MM/DD/YY.
when 'DD/MM/YYYY'.
write date_int to output_tab-external_date DD/MM/YYYY.
when 'DD/MM/YY'.
write date_int to output_tab-external_date DD/MM/YY.
endcase.
append output_tab.
Then make sure that the following fields of the field catalog contain the following:
LVC_S_FCAT-DATATYPE = 'CHAR'.
LVC_S_FCAT-INTTYPE = 'C'.
LVC_S_FCAT-INTLEN = '000010'.
LVC_S_FCAT-DD_OUTLEN = '000010'.
09-12-2008 10:12 PM
hi, to avoid this:
LVC_S_FCAT-DATATYPE = 'DATS'.
LVC_S_FCAT-INTTYPE = 'D'.
LVC_S_FCAT-INTLEN = '000008'.
LVC_S_FCAT-DD_OUTLEN = '000010'.
and all other things, just refer your field to a DATUM data element. Like this:
data:
....
....
date_today type datum,
....
....
The convertion of the field to DD/MM/YYYY will be automatically.
09-13-2008 2:32 AM
Hi,
Otherwise you can declare the date field as CHAR10, and you can write the date value in to that field as
: write dat1 into dat2 MM/DD/YYYY.
Where dat1 is of type DATS, and dat2 is of type CHAR10.
While passing into the ALV pass the dat2.
It will be solved.
Regards
Elini.P