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 in Scripts

Former Member
0 Likes
866

Dear All,

I want to change date format in script text elements. Now the date format is MMDDYYYY. Now I want change it into DDMMYYYY. How I can change that.

Thanks and regards,

Krish....

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
822

HI,

Use the SAP script control command

/: SET DATE MASK = 'MMMM DD, YYYY'

this will solve your requirement

Regards,

Jaya ramakumar

5 REPLIES 5
Read only

Former Member
0 Likes
822

Hi Krish,

Try using date mask with the following syntax.

Syntax

/: SET DATE MASK = 'date_mask'

Assuming a current system date of March 1st, 1997. 

/: SET DATE MASK = 'Foster City, MM.DD.YY' 
&DATE& -> Foster City, 03.01.97 
&DATE(Z)& -> Foster City, 3.1.97 

/: SET DATE MASK = 'MMMM DD, YYYY' 
&DATE& -> March 01, 1997

Ref. From Library.

Much Regards,

Amuktha.

Read only

Former Member
0 Likes
822

WRITE ONE Z PROGRAM .

EX. ZTEST

write the code below.


PROGRAM ZTEST.

form GET_NEWDATE tables in_tab STRUCTURE itcsy
out_tab STRUCTURE itcsy.

DATA : LV_NEWDATE TYPE D.

DATA : LV_OLDDATE LIKE OLDDATE,

data : gv_dd(2) type c,
gv_mm(2) type c,
gv_yy(4) type c.

data : date(8) type c.

gv_dd = LV_OLDDATE(+22).
gv_mm = LV_OLDDATE(2).
gv_yy = LV_DOC_DATE+4(4).

CONCATENATE gv_dd gv_mm gv_yy INTO date.

LV_NEWDATE = DATE.

read table OUT_tab index 1.
MOVE LV_NEWDATE TO OUT_TAB-VALUE.
CONDENSE OUT_TAB-VALUE.
MODIFY OUT_TAB INDEX 1.

ENDFORM.

write the code below in ur sapscript,

}
/:DEFINE &LV_NEWDATE&.
/:PERFORM GET_NEWDATE IN PROGRAM TEST
/:USING &LV_OLD_DATE&
/:CHANGING &LV_NEWDATE&.

PRINT &LV_NEWDATE&

ENDPERFORM.

Read only

Former Member
0 Likes
823

HI,

Use the SAP script control command

/: SET DATE MASK = 'MMMM DD, YYYY'

this will solve your requirement

Regards,

Jaya ramakumar

Read only

0 Likes
822

Hi,

Same Query was asked Just before...

Compare the solutions..

[Date Format|;

Thanks & regards,

Dileep .C

Read only

Former Member
0 Likes
822

Thanks for help..