Application Development 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: 

DATE FORMAT IN SAP

Former Member
0 Kudos

HI TO ALL ,

MY CLIENT IS AN US CLIENT AND WANT THE DEFAULT DATE AS

APR,20,2007 .THAT IS THEY WANT FIRST INITIAL THREE CHARACTERS FROM MONTH AND THEN DATE AND THEN YEAR.

I TRIED TO CHANGE THE USER SETTINGS BUT I AM ABLE TO GET ONLY

04/20/2007. CAN YOU HELP ME OUT TO GET THIS DATE FORMAT.

THANKS ,

LEKHRAM

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

As mentioned in my reply..

I believe It is not possible..

Thanks,

Naren

9 REPLIES 9

Former Member
0 Kudos

Hi,

Check these.

Date = YYYYMMDD

Concatenate date4(2) ‘ /’ date6(2) ‘/’ date(4) into Date2.

or

data : l_date(10) type c .

concatenate sy-datum6(2) '/' sy-datum4(2) '/' sy-datum(4) into l_date.

write : l_date.

or

data :l_date(10) type c

CALL FUNCTION 'CONVERT_DATE_TO_EXTERNAL'

EXPORTING

DATE_INTERNAL = SY-DATUM

IMPORTING

DATE_EXTERNAL = l_date.

this function module converts date from 20050601 to external format which is specified in user profile

or

PARAMETERS: P_DATE LIKE SY-DATUM.

DATA: T_MONTHS LIKE STANDARD TABLE OF T247 WITH HEADER LINE.

DATA: DATE LIKE AUSP-ATWRT.

CALL FUNCTION 'MONTH_NAMES_GET'

TABLES

MONTH_NAMES = T_MONTHS.

READ TABLE T_MONTHS WITH KEY MNR = P_DATE+4(2).

DATE(2) = P_DATE+6(2).

DATE+2(3) = T_MONTHS-KTX.

DATE5(2) = P_DATE2(2).

WRITE DATE.

Regards,

Laxmi

Former Member
0 Kudos

Laxmi...he need this format as a default for every user I guess.

I guess this format is not available in user setting so you can't set this format there. You have to work other way around.

Regards,

Amey

Message was edited by:

Amey Potale

Former Member
0 Kudos

Hi

use the command

SET DATE FORMAT MMMDDYYYY

or get the month, date and Year separately by offsetting the dates

then get the months description

then concatenate mdesc+0(3) date year into some variable and use

reward if useful

regards

Anji

Former Member
0 Kudos

Hi,

Guess we dont have a direct solution for this. You will have to use string processing to achieve what you need.

Cheers

VJ

Former Member
0 Kudos

Hi,

If You want give the input as APR 20 2007 in all the sap screens..Then I believe it is not possible..

Because sap supports the following external formats..

DD.MM.YYYY

MM/DD/YYYY

MM-DD-YYYY

YYYY.MM.DD

YYYY/MM/DD

YYYY-MM-DD

If they want to see that format in report output...Then check the following code..

DATA: V_INPUT(8) VALUE '20112006'.

DATA: V_CHAR(25).

data: date type sydatum.

DATA: MONTH_NAMES LIKE T247.

SELECT SINGLE * FROM T247

INTO MONTH_NAMES

WHERE SPRAS = SY-LANGU

AND MNR = V_INPUT+2(2).

CONCATENATE MONTH_NAMES-KTX V_INPUT(2) V_INPUT+4(4)

INTO V_CHAR SEPARATED BY SPACE.

write: / V_CHAR.

Thanks,

Naren

suresh_datti
Active Contributor
0 Kudos

you can use the function call CONVERSION_EXIT_SDATE_OUTPUT ie

data p_date sydatum.
data: p_out(50).
  
p_date = sy-datum
  call function 'CONVERSION_EXIT_SDATE_OUTPUT'
    exporting
      input  = p_begda
    importing
      output = p_out.
write: / p_out.

~Suresh

Former Member
0 Kudos

I AM EXTREMELY SORRY. THAT I WAS NOT VERY MUCH CLEAR IN MY INITIAL MESSAGE I NEED THIS FORMAT FOR ALL SAP STANDARD SCREENS AND NOT PARTICULARLY FOR ANY REPORT.

I WANT THIS AS A DEFAULT FORMAT FOR ALL MY SCREENS AND FOR ALL MY USERS.

LEKHRAM

Former Member
0 Kudos

Hi,

As mentioned in my reply..

I believe It is not possible..

Thanks,

Naren

0 Kudos

Hi Naren,

I am also finding that it is using XUDATFM Domain which is having limited value range .

1 DD.MM.YYYY

2 MM/DD/YYYY

3 MM-DD-YYYY

4 YYYY.MM.DD

5 YYYY/MM/DD

6 YYYY-MM-DD

7 GYY.MM.DD (Japanese Date)

8 GYY/MM/DD (Japanese Date)

9 GYY-MM-DD (Japanese Date)

A YYYY/MM/DD (Islamic Date 1)

B YYYY/MM/DD (Islamic Date 2)

Still if you people have any Idea Just do tell me .

Thanks & Regards ,

Lekhram