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 change in the sapscript

Former Member
0 Likes
7,179

Hi,

I have DATE format, like, YYYY/MM/DD, so, I need to convert it to DD/MM/YYYY in SAPSCRIPT.

How will u do that...

1 ACCEPTED SOLUTION
Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
3,099

Hello Dorothy,

The Date can be formatted using SET DATE MASK command.

In the SAPScript editor use the following command:

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

Hope this is clear to you.

BR,

Suhas

11 REPLIES 11
Read only

Former Member
0 Likes
3,099

hi

use this function in your print program 'TZ_SYSTEM_TO_LOCAL' to get the date in your local format.

alternately what you can do is that use SET DATE MASK control command like

SET DATE MASK = Walldorf, den DD.MM.YYYY

&SYST-DATUM& --> Walldorf 01.01.2008

hope this helps

regards

Aakash Banga

Read only

0 Likes
3,099

Hi

please explain more

Read only

0 Likes
3,099

Please search more.

Reported to SCN for rule violations

pk

Read only

0 Likes
3,099

hi,,

SEARCH IN SCN with SET DATE MASK.

make habbit for search in SCN before posting

thanks

Sachin

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
3,100

Hello Dorothy,

The Date can be formatted using SET DATE MASK command.

In the SAPScript editor use the following command:

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

Hope this is clear to you.

BR,

Suhas

Read only

Former Member
0 Likes
3,099

Hi Suhas, know it is an old post. I am trying a simple thing. In my SAPscript i want to add (date) however when it returns to SAP it uses a wrong date format.

30-06-2015

I need it to send to SAP

30.06.2015

I copied the /: SET DATE MASK = 'DD.MM.YYYY' into my script, however it gives a Error: expected statement

Hope you can help and sorry if it is a stupid question 🙂

I have added my full script here

If Not IsObject(application) Then
   Set SapGuiAuto  = GetObject("SAPGUI")
   Set application = SapGuiAuto.GetScriptingEngine
End If
If Not IsObject(connection) Then
   Set connection = application.Children(0)
End If
If Not IsObject(session) Then
   Set session    = connection.Children(0)
End If
If IsObject(WScript) Then
   WScript.ConnectObject session,     "on"
   WScript.ConnectObject application, "on"
End If

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


session.findById("wnd[0]").maximize
session.findById("wnd[0]/tbar[0]/okcd").text = "/nTransaction"
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/usr/txtSELECTION-SDAT").text = (DATE)
session.findById("wnd[0]/usr/txtSELECTION-STIME").text = "00:00:00"
session.findById("wnd[0]/usr/txtSELECTION-SREADTI").text = "06:00:00"
session.findById("wnd[0]/usr/txtSELECTION-SREADTI").setFocus
session.findById("wnd[0]/usr/txtSELECTION-SREADTI").caretPosition = 8
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/tbar[1]/btn[20]").press
session.findById("wnd[1]/usr/subSUBSCREEN_STEPLOOP:SAPLSPO5:0150/sub:SAPLSPO5:0150/radSPOPLI-SELFLAG[1,0]").select
session.findById("wnd[1]/usr/subSUBSCREEN_STEPLOOP:SAPLSPO5:0150/sub:SAPLSPO5:0150/radSPOPLI-SELFLAG[1,0]").setFocus
session.findById("wnd[1]/tbar[0]/btn[0]").press
session.findById("wnd[1]/usr/ctxtDY_FILENAME").text = "STAD_master.txt"
session.findById("wnd[1]/usr/ctxtDY_FILENAME").caretPosition = 15
session.findById("wnd[1]/tbar[0]/btn[7]").press
session.findById("wnd[0]/tbar[0]/btn[15]").press

Read only

Former Member
0 Likes
3,099

Hi Raj,

SET DATE MASK command is for that perpose.

Regards,

Pravin

Read only

former_member585060
Active Contributor
0 Likes
3,099

Hi,

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

P1 &DATE&

Regards

Bala Krishna

Read only

Former Member
0 Likes
3,099

Hi ,

Change the date format according to your country specific and put SET COUNTRY 'country name' statement in script editor.

Read only

Former Member
0 Likes
3,099

I got it

Read only

kmoore007
Active Contributor
0 Likes
3,099

This is controlled with a configuration setting the the country.  Look in the IMG under SAP NetWeaver->General Settings->Set Countries.