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

abap doubt

Former Member
0 Likes
1,307

hi this is satish,

how to change the date formate in the alv report.Actually the values are coming from the table.In the table the date format be yyyymmdd.but How to change the date formate in alv like ddmmyyyyy.Any one can send the code to change that format

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,279

Hi,

All you have to do is modify properties for this field in your fieldcatalog by setting the data type :

fieldcat-datatype = 'DATS'.

Then in your ALV report, system will automatically handle the output format for the field according to the user settings.

Regards,

Nicolas.

15 REPLIES 15
Read only

Former Member
0 Likes
1,279

Hi,

You can use FM CONVERSION_EXIT_PDATE_OUTPUT.

Thanks,

Sriram Ponna.

Read only

0 Likes
1,279

what is that exactly can u tell me

Read only

former_member188829
Active Contributor
0 Likes
1,279

Hi,

Use FM:

CONVERT_DATE_TO_EXTERNAL

Read only

Former Member
0 Likes
1,279

Hi Satish,

IN DB tables date format will be always YYYYMMDD only..in front end depending upon settings it dispalys in particular format....

still you need solutions there are....


 WRITE <datefld>  DD/MM/YYYY to <var>.

"OR
DATA : date LIKE sy-datum.
DATA : date2 TYPE CHAR10.
date = sy-datum.
CONCATENATE date+6(2) date+4(2)   date+0(4) INTO date2 SEPARATED BY '.'.
write :/ date2.
 

Read only

Former Member
0 Likes
1,279

hi,

you can use too:

data new_date type sy-datum.

WRITE your_date TO new_date DD/MM/YYYY.

I hope its help.

Read only

naimesh_patel
Active Contributor
0 Likes
1,279

Set the edit_mask in the field catalog for that field.

fcat-edit_mask = 'ddmmyyyy'.

Regards,

Naimesh Patel

Read only

0 Likes
1,279

fcat-edit_mask = 'ddmmyyyy'.

where we have to give this

in the fcat date is we r giving therre

Read only

0 Likes
1,279

You need to do like this for your DATE field

LOOP AT FCAT WHERE FIELDNAME = 'DATE'.
  LS_FCAT-EDIT_MAST = 'DDMMYYYY'.
  MODIFY FCAT FROM LS_FCAT.
  CLEAR LS_FCAT.
ENDLOOP.

Regards,

Naimesh Patel

Read only

0 Likes
1,279

actually that is alv report.

the values are coming from table(In pbo module fetch data from select query into inernal table)But the date is in the format yyyymmdd.Now i want to change the date in alv report that ddmmyyyy.Please send code/

Read only

0 Likes
1,279

This setting which I had provided you are for the ALV only.

In your ALV, you are filling up the feild cataloge. Just add the code which I have provided you.

Regards,

Naimesh Patel

Read only

0 Likes
1,279

Hi..

Try this code ,i had hardcode the date in yyyymmdd format but the output is coming in ddmmyyyy format itself..

REPORT ZBA_ALV.

type-pools slis.

data : begin of itab occurs 0,

date type d ,

end of itab,

it_fieldcat type slis_t_fieldcat_alv,

wa_fieldcat type slis_fieldcat_alv.

start-of-selection.

itab-date = '20071121'.

append itab.

wa_fieldcat-fieldname = 'DATE'.

append wa_fieldcat to it_fieldcat.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = sy-repid

IT_FIELDCAT = it_fieldcat

TABLES

t_outtab = itab.

Post for further queries.

Regards

Bala.

Read only

Former Member
0 Likes
1,279

Satish,


REPORT  ZTEST_TEST.

DATA : date type sy-datum.
data : date1(10) type c.
break akumar.
date = '20070321'.

write : date.

CONCATENATE date+6(2)  date+4(2)  date+0(4) into date1.

write /: date1.

Regards

Aneesh.

Read only

Former Member
0 Likes
1,279

Hi.

Try like this.

CLEAR l_s_field_cat.

l_s_field_cat-fieldname = 'Date'.

<b> l_s_field_cat-edit_mask = '__,__%'.</b>

APPEND l_s_field_cat TO p_tab_field_cat.

Regards

Bala.

Read only

Former Member
0 Likes
1,280

Hi,

All you have to do is modify properties for this field in your fieldcatalog by setting the data type :

fieldcat-datatype = 'DATS'.

Then in your ALV report, system will automatically handle the output format for the field according to the user settings.

Regards,

Nicolas.

Read only

Former Member
0 Likes
1,279

ya finnay i solved this