01-16-2013 12:51 PM
Hi Guys,
I want date to be in format MON YYYY i.e like Jan 2013.I searched and found all other formats but not this one.
I am extracting date from month_plus_determine Fm and need to display it in this format MON YYYY.
Can you help me with this?
Thanks.
01-16-2013 12:56 PM
Hi Dharmin,
Form a temporary internal table with months and corresponding names.(ex: 1 JAN, 2 FEB...)
You can use concatenate command to concatenate month name(read from above temp internal table) and with the year from the date you already have.
Reward if helpful.
Regards,
Mahidhar.
01-16-2013 12:57 PM
01-16-2013 2:15 PM
Hi Dharmin,
You could use a simple CASE to do the same.
Check the numeric value of month in the complete date and replace/concatenate the date in your required format into a character/string type variable.
Please see the sample code
CASE var. (Where var would be the month in number)
or
CASE date+4(2).
WHEN '01'.
CONCATENATE date(4) 'JAN' INTO string.
WHEN '02'......and so on.
Hope this helps
01-16-2013 7:17 PM
Hi,
Instead of using custom code, you can use the standard FM /OSP/TRVL_CONV_DATE_LNG_FORMAT.
You can give input as
IV_INPUT 20121212
IV_LANGUAGE
IV_DATE_FORMAT 4
and you will get output as thjs
EV_OUTPUT 2012 December 12
Now, you can take the first 4 characters of year and first 3 characters of month to get the required value.
Thanks,
Sreekanth
01-17-2013 9:54 AM
Hi,
There are 2 ways to do it.
1. Get the Month Number using the FM : 'CACS_DATE_GET_YEAR_MONTH'
Then get the name of the month in any language from the table : T247
2. Use FM - 'CACS_DATE_GET_YEAR_MONTH'
Get Month Name - MONTH_NAMES_GET
Finally use Concatenate statement and display in the way you want.
Thanks and Regards.
Rajender Patyal
01-18-2013 9:33 AM
DATA: ext TYPE RN1DATUM-DATEX.
USE FM 'FORMAT_DATE_4_OUTPUT'.
CALL FUNCTION 'FORMAT_DATE_4_OUTPUT'
EXPORTING
datin = SY-DATUM
format = 'DD-MM-YYYY'
IMPORTING
DATEX = ext .
WRITE: ext .
Reward point if this is useful.
01-18-2013 9:43 AM
Try this one also.
DATA: ext TYPE rn1datum-datex.
CALL FUNCTION 'FORMAT_DATE_4_OUTPUT'
EXPORTING
datin = sy-datum
format = 'MM-YYYY'
IMPORTING
datex = ext.
DATA: srt_txt type T247-KTX ,
srt_date type T247-MNR .
srt_date = ext(2).
CALL FUNCTION 'ISP_GET_MONTH_NAME'
EXPORTING
* DATE = sy-datum
language = sy-langu
MONTH_NUMBER = srt_date
IMPORTING
* LANGU_BACK =
* LONGTEXT =
SHORTTEXT = srt_txt
* EXCEPTIONS
* CALENDAR_ID = 1
* DATE_ERROR = 2
* NOT_FOUND = 3
* WRONG_INPUT = 4
* OTHERS = 5
WRITE: srt_txt, ext+2 .