Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

date format

hi friends,

user has to upload data to TCODE here DATE field has to

accept all formats[eg.MM/DD/YYYY,DD/MM/YYYY,YYYY/MM/DD etc.,,] so plz tell how to code this r is there any variable plz suggest me any code with eg

thanks

soorya

Tags:
replied

hi

each user has a defualt date setting maintaineed in

USR01

so first make a query on the usr01 table and get the default date

then convert all the dates into the default user format.

in the sample code i'm taking simple date like 20060101

and getting year month & date

SELECT SINGLE DATFM

FROM USR01

INTO (V_DATFORMAT)

WHERE BNAME = SY-UNAME.

YEAR = DATESTRING+0(4).

MONTH = DATESTRING+4(2).

DATE = DATESTRING+6(2).

CASE V_DATFORMAT.

WHEN 1.

CONCATENATE DATE MONTH YEAR INTO DATESTRING SEPARATED BY '.'.

WHEN 2.

CONCATENATE MONTH DATE YEAR INTO DATESTRING SEPARATED BY '/'.

WHEN 3.

CONCATENATE MONTH DATE YEAR INTO DATESTRING SEPARATED BY '-'.

WHEN 4.

CONCATENATE YEAR MONTH DATE INTO DATESTRING SEPARATED BY '.'.

WHEN 5.

CONCATENATE DATE MONTH YEAR INTO DATESTRING SEPARATED BY '/'.

WHEN 6.

CONCATENATE DATE MONTH YEAR INTO DATESTRING SEPARATED BY '-'.

ENDCASE.

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question