2014 Mar 31 9:28 AM
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
2014 Mar 31 9:44 AM
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
2014 Mar 31 9:44 AM
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
2014 Mar 31 9:53 AM
You can use the FM CONVERT_DATE_TO_INTERNAL to convert date to sap date format.
2014 Mar 31 10:11 AM
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.
2014 Mar 31 10:18 AM
Then you can use FM /SAPDII/SPP05_CONVERT_DATE to convert system date to external format.
2014 Mar 31 10:24 AM
Hi Gagan,
Thanks, Unfortunately, I am not able to see that FM in solution manager as I am developing this program there.
2014 Mar 31 10:45 AM
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.
2014 Mar 31 10:40 AM
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 '.
2014 Mar 31 1:14 PM
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
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |