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

Selection Screen - Date and Time

silentbull
Participant
0 Likes
8,804

Hi,

I have given a selection screen where the user needs to key in the input in the following format

dd.mm.yyyy hh:mm:ss.

Reason is that the database fetching these elements accepts only in this criteria.

Now as they look into automating this program, they would want to automatically take the current system date and time - 24 hours .

How do I achieve this in the above format? If this is not possible, let me know if i can make the selection screen with normal sap date format and convert it to the above format on passing to the select statement.

Regards

Sam

1 ACCEPTED SOLUTION
Read only

jogeswararao_kavala
Active Contributor
0 Likes
4,169

Hi Sam,

You may try Data type TMSTMP for the field and use input format 20140331141500 for Date 31/03/2014 and time 141500 hrs.

Jogeswara Rao K

Hi,

I have given a selection screen where the user needs to key in the input in the following format

dd.mm.yyyy hh:mm:ss.

Reason is that the database fetching these elements accepts only in this criteria.

Now as they look into automating this program, they would want to automatically take the current system date and time - 24 hours .

How do I achieve this in the above format? If this is not possible, let me know if i can make the selection screen with normal sap date format and convert it to the above format on passing to the select statement.

Regards

Sam

8 REPLIES 8
Read only

jogeswararao_kavala
Active Contributor
0 Likes
4,170

Hi Sam,

You may try Data type TMSTMP for the field and use input format 20140331141500 for Date 31/03/2014 and time 141500 hrs.

Jogeswara Rao K

Read only

0 Likes
4,169

You can use the FM CONVERT_DATE_TO_INTERNAL to convert date to sap date format.

Read only

0 Likes
4,169

Hello Gagan,

I think I would need the reverse as I need to setup automatic date - 24 in the varient So the system date should be converted to the external format.

Read only

0 Likes
4,169

Then you can use FM /SAPDII/SPP05_CONVERT_DATE to convert system date to external format.

Read only

0 Likes
4,169

Hi Gagan,

Thanks, Unfortunately, I am not able to see that FM in solution manager as I am developing this program there.

Read only

0 Likes
4,169

Try with below code.

DATA : date1 TYPE syst-datum,
             lv1 TYPE c LENGTH 10.

date1 = sy-datum.

WRITE date1 USING EDIT MASK '__/__/____' TO lv1.
WRITE lv1.

Read only

Former Member
0 Likes
4,169

You can try this.

DATA:
   l_tst TYPE timestamp.

GET TIME STAMP FIELD l_tst.

*date - 24
l_tst l_tst - '00000001000000'.

WRITE: l_tst TIME ZONE 'UTC   '.

Read only

jogeswararao_kavala
Active Contributor
0 Likes
4,169

Hi Sam,

See this. Is this your requirement.

With this we are able to get Current time-stamp to selection parameter.

REPORT ZTEST.

DATA: L_TS TYPE TZNTSTMPS,
       L_TS_C TYPE CHAR14.

PARAMETERS:
P_TMSTMP TYPE TMSTMP OBLIGATORY MEMORY ID TEST.

INITIALIZATION.
   GET TIME STAMP FIELD L_TS.
   MOVE L_TS TO L_TS_C.
   SET PARAMETER ID  'TEST' FIELD L_TS_C.

The output is

Jogeswara Rao K