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
1,512

Hi!

How can convert variable(date) from format yyy.mm.dd to dd.mm.yyyy?

Thanks forehead!

1 ACCEPTED SOLUTION
Read only

vinod_gunaware2
Active Contributor
0 Likes
1,305

hi

Use write statement.

use f1 or goto pattarn -> WRITE -> FIELD(specify name)->

Multiple selection(yellow arrow button button)-> for date fields (Chck box and radio button)

WRITE - Formatting options

... DD/MM/YY

... MM/DD/YY

... DD/MM/YYYY

... MM/DD/YYYY

... DDMMYY

... MMDDYY

... YYMMDD

U can use into another variable.

and then use that particular variable.

regards

vinod

Message was edited by: Vinod Gunaware

13 REPLIES 13
Read only

FredericGirod
Active Contributor
0 Likes
1,305

Hi,

if you want to display into your screen, just write the variable type d.

write w_date (that will show you as your country standard)

if you want to set into a char type

concatenate date6(2) date4(2) date+0(4) into w_char separated by '.'.

Remember that SAP store date into a type and display sometime into another one. SAP used field-exit to perform this.

Rgd

Frédéric

Read only

vinod_gunaware2
Active Contributor
0 Likes
1,306

hi

Use write statement.

use f1 or goto pattarn -> WRITE -> FIELD(specify name)->

Multiple selection(yellow arrow button button)-> for date fields (Chck box and radio button)

WRITE - Formatting options

... DD/MM/YY

... MM/DD/YY

... DD/MM/YYYY

... MM/DD/YYYY

... DDMMYY

... MMDDYY

... YYMMDD

U can use into another variable.

and then use that particular variable.

regards

vinod

Message was edited by: Vinod Gunaware

Read only

Former Member
0 Likes
1,305

Hi Welcome !!

System menu>user profile>own data >defaults>date format set to dd.mm.yyyy

===============================

FModules

CONVERT_DATE_TO_INTERNAL

CONVERT_DATE_TO_EXTERNAL

===============================

Dynamically u can do by writing a program

Use any of the foll. FM

HRGPBS_HESA_DATE_FORMAT

Format a date valid for HESA: DD/MM/YYYY

HRGPBS_TPS_DATE_FORMAT

Format a date valid for TPS: DDMMYY

SLS_MISC_GET_USER_DATE_FORMAT

get the date format the user has defined as his/her default

========================================

REPORT ZES .

data: v_date type char10.

CALL FUNCTION 'HRGPBS_HESA_DATE_FORMAT'

EXPORTING

p_date = sy-datum

IMPORTING

DATESTRING = v_date.

replace all occurences of '/' in v_date with '.' .

write v_date.

hope it solves your problem. pls close the thread by allocating points if u satisfy with solutions.

Message was edited by: Eswar Kanakanti

Read only

Former Member
0 Likes
1,305

Hi,

Try the FM: Try FM 'CONVERT_DATE_TO_EXTERNAL'

http://help.sap.com/saphelp_nw04/helpdata/en/07/d63a68db9110459d63c495b16f522e/content.htm


DATA: lv_date(10) type c,
      fi_date(10) type c.

lv_date = '2006.03.02'.

CONCATENATE lv_date+8(2) '.' lv_date+5(2) '.' lv_date+0(4) into fi_date.

write: fi_date.

OP: 02.03.2006

Best Regards,

Anjali

Read only

Former Member
0 Likes
1,305

Hi los,

1. simple.

2. REPORT abc.

DATA : d1(10) TYPE c.

DATA : d2(10) TYPE c.

d1 = '2006.02.25'.

CONCATENATE d18(2) '.' d15(2) '.' d1(4) INTO d2.

WRITE d2.

regards,

amit m.

Read only

hymavathi_oruganti
Active Contributor
0 Likes
1,305

1.U CAN USE 'USING EDIT MASK' statement with write

write d using edit mask dd.mm.yyyy

2. or u can declare a char variable of 10

use concatenate statement

data: date(10).

concatenate d(2) '.' d2(2) '.' d4(4) into date

Message was edited by: Hymavathi Oruganti

Read only

Former Member
0 Likes
1,305

OK, thanks a lot!

Read only

Former Member
0 Likes
1,305

OK, now I have another problem.

I used "write" and it changed format to dd.mm.yyyy, but it inserts delimeter(.), so how can i delete the (.)?

Read only

0 Likes
1,305

Hi again,

1. simple.

2.

data: m(10) type c.

m = '22.05.2006'.

<b>replace all occurrences of '.' in m with ''.</b>

write m.

regards,

amit m.

Read only

0 Likes
1,305

THEN WHILE WRITING WRITE STATEMEENT ITSELF, INSTEAD OF '.'

GIVE A SPACE

WRITE DATE USING EDIT MASK 'DD MM YYYY'

Read only

0 Likes
1,305

THANKS!

Read only

Former Member
0 Likes
1,305

Hi,

1. As per the forum etiquette,

u may pls award points

to helpful answers by clicking the STAR

on the left of that reply.

regards,

amit m.

Read only

vinod_gunaware2
Active Contributor
0 Likes
1,305

Hi

It show me completely solve query however the point for it is not yet updated.

Is pt assignment development not working properly?

Regards

Vinod