Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

date format

Former Member
0 Likes
797

Hi EXPERTS,

Posting dates of all the items are displayed in an alv display. for this the dates are fetched from tables and stored in internal table and this internal table is sent for alv grid display.

EARLIER when this was working in 4.6c the output was dd.mm.yyyy but after upgrade in ecc 6.0 the output is yyyymmdd. the client wants it in the earlier format.

there are lot of reports facing the same problem.

how can i handle this.

please help.

8 REPLIES 8
Read only

Former Member
0 Likes
769

Hi,

Try this code.

TYPES: BEGIN OF type_t_date,

mm(2) TYPE c,

filler1(1) TYPE c,

dd(2) TYPE c,

filler2(1) TYPE c,

yyyy(4) TYPE c,

END OF type_t_date.

DATA: t_ddate TYPE type_t_date.

CONSTANTS: c_fil TYPE c VALUE '.'.

t_ddate-mm = rs_sdate-mm.

t_ddate-dd = rs_sdate-dd.

t_ddate-yyyy = rs_sdate-yyyy.

t_ddate-filler1 = c_fil.

t_ddate-filler2 = c_fil.

CONCATENATE t_ddate-mm t_ddate-filler1 t_ddate-dd t_ddate-filler2 t_ddate-yyyy INTO rv_ddate.

u can refer thsi code and make changes accordingly to ur report..

points?

Read only

anversha_s
Active Contributor
0 Likes
769

hi,

simply declare that field in the interbal table like below.


data : f_date like database_table-date_field. "give a date field here

Regards

Anver

Read only

Former Member
0 Likes
769

Hi,

In field catalog U have the option <b>EDIT MASK</b>. U can use that. I think it will work.

Regrads,

Balavardhan.K

Read only

Former Member
0 Likes
769

Hi Priya,

Since your Date format is not decided(xyz format), I think you need to decide your approach.

To dispaly the Date form System Format to User Format the FM 'CONVERT_DATE_TO_EXTERNAL' is used.

Consider this code.

REPORT zztest.

DATA: e_date(10) type c VALUE '2/2/2006',

i_date(10).

CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'

EXPORTING

date_external = e_date

IMPORTING

date_internal = i_date

EXCEPTIONS

date_external_is_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.

WRITE : / 'CONVERT_DATE_TO_INTERNAL',

/ 'My Date:' , e_date ,

'Conv Date:', i_date.

skip 2.

CALL FUNCTION 'CONVERT_DATE_TO_EXTERNAL'

EXPORTING

DATE_INTERNAL = sy-datum

IMPORTING

DATE_EXTERNAL = e_date

EXCEPTIONS

DATE_INTERNAL_IS_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.

WRITE : / 'CONVERT_DATE_TO_EXTERNAL',

/ 'My Date:' , sy-datum,

'Conv Date:', e_date.

Regards,

Seema

Read only

Former Member
0 Likes
769

Hi,

As per my understanding, the date format is depending on user profile,

If you want to check it, goto menu path System -> User Profile -> Owndata and goto defaults and set date format as required.

May be it will solve your problem.

Thanks

Read only

Former Member
0 Likes
769

Hi,

In the field catalog there are two fields EDIT_MASK and CONVEXIT which is used to specify the edit mask and the concersion exit to be used for the field.

Try using it.

Regards

Arun

Read only

Former Member
0 Likes
769

DATA: lv_date(10) TYPE c.

CONCATENATE date_field+6(2)

date_field+4(2)

date_field(4) INTO lv_date SEPARATED BY '.'.

date_field is where your date is in format yyyy.mm.dd

regards

Read only

Former Member
0 Likes
769

Hi,

try this way :-

write: / sy-datum6(2) ,3 '.',4 sy-datum4(2), 6 '.', 7 sy-datum+0(4).