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 yyyymmdd required

Former Member
0 Likes
4,766

Hi,

I required to display the date in the format

yyyymmdd.

But my internal table is getting populated with the

date format dd.mm.yyyy.

Please let me know how to proceed.

Thanks in Advance

Irfan Hussain

Hi,

I required to display the date in the format

yyyymmdd.

But my internal table is getting populated with the

date format dd.mm.yyyy.

Please let me know how to proceed.

Thanks in Advance

Irfan Hussain

17 REPLIES 17
Read only

hymavathi_oruganti
Active Contributor
0 Likes
3,120

try this fn module

'CONVERSION_EXIT_IDATE_OUTPUT'

Read only

Former Member
0 Likes
3,120

data w_date(8) type c.

Say the date is in sy-datum and that needs to be picked up...

w_date = sy-datum.

write w_date...

output will be in yyyymmdd.

Read only

Former Member
0 Likes
3,120

Hi irfan,

1. We can apply logic also.

using OFFSET concept.

2. this logic (just copy paste in new program)

REPORT abc LINE-SIZE 1023..

DATA : s(10) TYPE c.

DATA : d TYPE sy-datum.

s = '10.05.2006'.

CONCATENATE s6(4) s3(2) s(2) INTO d.

WRITE 😕 d.

regards,

amit m.

Read only

Former Member
0 Likes
3,120

Hi Irfan,

You pass your internal table date format dd.mm.yyyy to Function module CONVERT_DATE_TO_INTERNAL

to get the date format as yyyymmdd.

Hope this will help you.

Please award points, if you find my answer fruitful.

Regards,

Kapil

Read only

Former Member
0 Likes
3,120

try using edit mask .

in the write statement to the internal table.

Read only

Former Member
0 Likes
3,120

Hi Irfan,

U can wirte it by using "EDIT MASK" by using it in "WRITE TO" statement.

WRITE SY-DATUM TO TEMP USING EDIT MASK "__:__:____"

U can mention ur format in the double codes.

To change 20040924

to 24.09.2004 format.

Try FM 'CONVERT_DATE_TO_EXTERNAL'

Best Regards,

Anjali

Read only

Former Member
0 Likes
3,120

irfan,

use this code okay ..

data: var(10).

write:/ sy-datum.

var = sy-datum.

write (10) var using edit mask '____:__:__'.

this will solve ur problem ,

u can try with fm also .

Read only

0 Likes
3,120

Hi,

Presntly I am doing a function module ,

This table has to be displayed to the user with the date form mm.dd.yyyy.

actualy during debugging i observd that the date is fetched from the database in the format yyyymmdd,

but in the output it is displayed as dd.mm.yyyy. due to system settigns.

But i want to make appear as dd.mm.yyyy.

Please help me out.

Thanks in Advance

Irfan Hussain

Read only

0 Likes
3,120

WRITE SY-DATUM USING EDIT MASK '__.__.____'.

Read only

0 Likes
3,120

Hi

The output format depends on user default parameters: here the user can set the format date.

Max

Read only

0 Likes
3,120

HI

you can implement your own logic

data: dat(10) type c.

dat = '10.02.2006'.

concatenate dat3(3) dat0(3) dat+6(4) into dat.

write dat.

regards

kishore

Read only

0 Likes
3,120

Hi,

While pciking form the database it is picking as yyyyddmm, but while displaying it is displaying as

dd.mm.yyyy.

This is the system setting i do agree with it.

but the fields in the database are defined as dats,

so as per the system setting the output is reflected.

But I want to display as yyyymmdd in it's original format.

Thanks in Advance,

Irfan Hussain

Read only

0 Likes
3,120

let me re-phrase the question

you want the date in the internal table to be displayed as

dd.mm.yyyy?

if yes then declare one more field in your internal table as

date(10) type c.

now after selecting the data from the database into the internal table ( itab ), loop the internal table and

do this

write itab-databasedatefield(YYYYMMDD) to itab-date dd.mm.yyyy.

Now in the internal table itab , date field will have your date as dd.mm.yyyy.

if this is the solution, please close the topic.

Read only

0 Likes
3,120

Hi Irfan,

you can go to <b>System -> User profile -> Own Data.</b>there, when you click the defaults tab , you can see the various date options. From that , you can choose the desired formating option.

Formatting options for date fields are :

<b>DD/MM/YY</b>

<b>MM/DD/YY</b>

<b>DD/MM/YYYY</b>

<b>MM/DD/YYYY</b>

<b>DDMMYY</b>

<b>MMDDYY</b>

<b>YYMMDD</b>

Note : separtaors wherever mentioned are as in the user's master record.

<b>* Test program after making the change.

REPORT ZKUN_TEST .

WRITE: sy-datum. " sy-datum is the system field.

</b>

output :

02/06/2006

Hope it solves your problem.

In case of doubt , feel free to mail me.

thnaks and regards,

kunal

Read only

santosh_patil6
Explorer
0 Likes
3,120

Mr Irfan, Would please take time to reward the points and close the topic;If your issue has been resolved.

You have 6 replies conveying the same solution.

Read only

Former Member
0 Likes
3,120

Hello Irfan,

Check whether call functions help you in any way...

This link gives you some idea in Date and time section..

http://www.geocities.com/victorav15/sapr3/abapfun.html

Regards,

Srikanth

Read only

Former Member
0 Likes
3,120
  • this is an exmple showing the date being displayed in *yyyymmdd format.

<b>REPORT ZKUN_TEST .

data : a type string.

a = sy-datum.

WRITE: sy-datum .

skip.

write : / a.</b>

<u><b>output:</b></u>

02/16/2006

20060216

if you feel its correct , do reward with points.

thanks and regards,

kunal.