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

Set date Mask in Sapscript

Former Member
0 Likes
5,109

hi all,

Requirement is to diplay todays date in MM.DD.YYYY format in a smartform layout.

We have used the command

/:SET DATE MASK = 'MM.DD.YYYY'

/:SET COUNTRY 'US'

&sy-datum&

But the date appears in the user format DD.MM.YYYY.

Whys the set date command not working here as expected ?

Your ideas appreciated.

Rgds,

stock

hi all,

Requirement is to diplay todays date in MM.DD.YYYY format in a smartform layout.

We have used the command

/:SET DATE MASK = 'MM.DD.YYYY'

/:SET COUNTRY 'US'

&sy-datum&

But the date appears in the user format DD.MM.YYYY.

Whys the set date command not working here as expected ?

Your ideas appreciated.

Rgds,

stock

5 REPLIES 5
Read only

Former Member
0 Likes
1,761

Hi Stock Sys,

Formatting Date Fields: SET DATE MASK

To define the formatting of date fields, use the SET DATE MASK control command. Executing this command causes all subsequent date fields to be printed using the specified format.

Syntax:

/: SET DATE MASK = 'date_mask'

In the date mask, you can use the following codes:

DD: day (two digits)

DDD: day name - abbreviated

DDDD: day name - written out in full

MM: month (two digits)

MMM: month name - abbreviated

MMMM: month name - written out in full

YY: year (two digits)

YYYY: year (four digits)

LD: day (formatted as for the L option)

LM: month (formatted as for the L option)

LY: year (formatted as for the L option)

All other characters found in a date mask are interpreted as simple text and are copied straight into the output.

Assuming the current system date is March 1st, 1997.

/: SET DATE MASK = 'Foster City, MM/DD/YY'

&DATE& -> Foster City, 03/01/97

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

&DATE& -> March 01, 1997

The date mask may be reset to the default setting by using an empty string:

/: SET DATE MASK = ' '

The abbreviated and full forms of the names of the days and months are stored in the language dependent TTDTG table under the following keys:

%%SAPSCRIPT_DDD_dd: abbreviated day name

%%SAPSCRIPT_DDDD_dd: full form of day name

%%SAPSCRIPT_MMM_mm: abbreviated month name

%%SAPSCRIPT_MMMM_mm: full form of month name

dd: day number 01 = Monday,..., 07 = Sunday

mm: month number 01 = January,..., 12 = December

Regards.

Eshwar.

Read only

Former Member
0 Likes
1,761

Hi,

I think the problem is in using sy-datum create a variable of type D and then try

Regards

Read only

Former Member
0 Likes
1,761

Check the User profile Parameters:

System>Own Data> Defaults

Change it to the desired format.

Hope this Helps.

Regards

Vinayak

Read only

Former Member
0 Likes
1,761

Hi..

Please check the table T005X, for the setting for the country US. SET COUNTRY 'US' sets the format for the date and the currency formats. Your command must be overwriting the SET DATE MASK command as you are using the SET COUNTRY command after that.

Please check.

Edited by: Ashwani Kalkal on Mar 13, 2008 10:44 AM

Read only

Former Member
0 Likes
1,761

Hi Experts,

and how would you solve this?

Now I have

/:   SET DATE MASK = 'DD.MM.YYYY'

/    &DATE&

and would like to have for US "YYYY/MM/DD" and for others 'DD.MM.YYYY'

Please advice. I am beginner.

Thank you very much.

Kasia