‎2016 Sep 19 6:29 PM
Hi experts,
I need to Print the current date and time in this format:
DD-MMM-YYYY -- HH:MM
DD = day
MMM = three character month abbreviation
YYYY = four digit year
HH = hour
MM = minute
‎2016 Sep 19 7:57 PM
‎2016 Sep 20 12:43 PM
‎2016 Sep 19 8:19 PM
You could use function module MONTH_NAMES_GET to decode the 2-digit month to 3-character month and just concatenate the date/time string together.
Loyd
‎2016 Sep 19 8:34 PM
Hi loyd,
Final output should be in smartforms.... Can you please explain for this case....
Thanks
‎2016 Sep 19 9:16 PM
Texts are based on SAPscript technology, so you may use Formatting Date Fields: SET DATE MASK - BC Style and Form Maintenance - SAP Library
‎2016 Sep 19 10:26 PM
cl_abap_datfm and cl_abap_timfm will help with the rest of the formatting. Then use the MONTH_NAMES_GET and replace the month portion.
‎2016 Sep 19 8:44 PM
Or you could go crazy and do something like this:
DATA: BEGIN OF o_date,
dd TYPE numc2,
dash1 TYPE char01 VALUE '-',
mon TYPE char03,
dash2 TYPE char01 VALUE '-',
year TYPE char04,
fill01 TYPE char02 VALUE ' -',
fill02 type char02 value '- ',
hh TYPE char02,
colon TYPE char01 VALUE ':',
mm TYPE char02,
END OF o_date.
DATA: BEGIN OF my_datum,
year TYPE char04,
mm TYPE char02,
dd TYPE char02,
END OF my_datum.
DATA: BEGIN OF my_timlo,
hh TYPE char02,
mm TYPE char02,
ss TYPE char02,
END OF my_timlo.
MOVE: sy-datum TO my_datum,
sy-timlo TO my_timlo.
MOVE-CORRESPONDING: my_datum TO o_date,
my_timlo to o_date.
SELECT SINGLE ktx FROM t247
INTO o_date-mon
WHERE mnr = my_datum-mm.
WRITE: / o_date.
‎2016 Sep 20 1:28 PM
Use below function module .
CONVERSION_EXIT_SDATE_OUTPUT
Input is sy-datum present date '20160920'.
Save it in String.
Next get Hours and minutes from sy-uzeit Then concatenate into the Sams string.
then display it into the Text of the Smart form