2022 Jun 14 7:07 PM
Hi all,
I've been looking at various ways to achieve my task of converting a numeric month to a 3-letter alpha
The Period "04" should be "Apr 2022".
I'm seeing some people suggest using CASE...ENDCASE, others using a SELECT on t247, and others using FMs.
What is the best way to do this?
Thank you in advance.
2022 Jun 14 7:17 PM
Hi
You can use the FM MONTH_NAMES_GET
This will return the internal table with month names . You can read this internal table and concatenate with year
2022 Jun 14 7:17 PM
Hi
You can use the FM MONTH_NAMES_GET
This will return the internal table with month names . You can read this internal table and concatenate with year
2022 Jun 14 8:56 PM
2022 Jun 14 11:36 PM
Here's what I did:
* FM /CPD/GET_MONTH_NAME for 3 char month
DATA: v_mlong LIKE t247-ltx, " long text
v_mshort LIKE t247-ktx. " short text
CALL FUNCTION '/CPD/GET_MONTH_NAME'
EXPORTING
* DATE = '00000000'
language = sy-langu
month_number = wa_itab3-prodallocationperiodstartdate+4(2)
IMPORTING
* LANGU_BACK =
longtext = v_mlong
shorttext = v_mshort
EXCEPTIONS
calendar_id = 1
date_error = 2
not_found = 3
wrong_input = 4
OTHERS.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
This is what was returned:
It's perfect!
Thank you very much Venkat.
2022 Jun 14 8:04 PM
It would be better to use the FM if it's released, but I think it's not, so it's up to you.