08-05-2008 8:13 AM
Hi all ,
We have a requirement to get Month number "not an name" from the DATE,e.g IF date is 02/04/2008 we need a FM which can generate month number as '02'.
Thanks and Regards,
Priya
08-05-2008 8:14 AM
08-05-2008 8:14 AM
08-05-2008 8:15 AM
Hi
Try this...
Data: date1 type D.
Data: mon(2) type N.
date1 = sy-datum.
mon = date+4(2).
Write:/ mon, date1.
Hope it helps.
Murthy
08-05-2008 8:16 AM
Hi,
Check this code.
REPORT z_sdn.
PARAMETERS:
p_date TYPe sy-datum.
DATA:
w_date TYPE sy-datum,
w_temp(2) TYPE n.
w_date = p_date.
w_temp = w_date+4(2).
WRITE:
w_temp.
Regards
Abhijeet
08-05-2008 8:16 AM
Hi,
Is you date format fixed? to mm/dd/yyyy?
If yes then refer to Rajesh's solution..
Regards,
Sagar.
08-05-2008 8:17 AM
08-05-2008 8:17 AM
hi,
try this Function module
FUNCTION MONTH_NAMES_GET.
*"----
Lokale Schnittstelle:
IMPORTING
VALUE(LANGUAGE) LIKE SY-LANGU DEFAULT SY-LANGU
EXPORTING
VALUE(RETURN_CODE) LIKE SY-SUBRC
TABLES
MONTH_NAMES STRUCTURE T247
EXCEPTIONS
MONTH_NAMES_NOT_FOUND
Regards,
Anirban
08-05-2008 8:17 AM
Hi Supriya,
Pls check FM : CACS_DATE_GET_YEAR_MONTH
Regards,
Suresh.S
08-05-2008 8:17 AM
Hi Supriya Nagotkar,
No need for any function module for that just take the offset of the data.
See the follwoing.
w_month = w_date+4(2).
Regards,
Mahi.
08-05-2008 8:25 AM
Hi,
Either we can use FM or coding is also enough
DATA: P_DATE TYPE SY-DATUM DEFAULT SY-DATUM.
l_MONTH = P_DATE+04(02).
or
Use Fumction Module " CACS_DATE_GET_YEAR_MONTH "
CALL FUNCTION 'CACS_DATE_GET_YEAR_MONTH'
EXPORTING
I_DATE = P_DATE
IMPORTING
E_MONTH = L_MONTH
.
Thanx,
dhanashri.
08-05-2008 8:28 AM
Function module used is
HR_IN_GET_DATE_COMPONENTS
input the date and get the month number
Import parameters Value
IDATE 20080208
Export parameters Value
DAY 08
MONTH 02 "<---month number
YEAR 2008
STEXT FEB
LTEXT February
USERDATE 08.02.2008
08-05-2008 8:29 AM
Hi ...
As Your question is answered please do Close the thread...
regards,
sg
08-05-2008 12:03 PM
Hi,
Just go through this it may help u....
REPORT ZASHU_MONTH_NAMES_GET.
data:r_code type sy-subrc.
data:mnames type standard table of T247 with header line.
CALL FUNCTION 'MONTH_NAMES_GET'
EXPORTING
LANGUAGE = SY-LANGU
IMPORTING
RETURN_CODE = r_code
TABLES
month_names = mnames.
EXCEPTIONS
MONTH_NAMES_NOT_FOUND = 1
OTHERS = 2
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CASE mnames.
when 'January'
..
when 'February'.
...
endcase.
Thanks & Regards
Ashu Singh