‎2007 Jan 22 3:38 PM
Is there any function module to check whether current date falls under which quarter..
01.01.2007 to 31.03.2007 is first quarter,
01.04.2007 to 30.06.2007 is second quarter
01.07.2007 to 31.09.2007 is third quarter
01.10.2007 to 31.12.2007 is four quarter..
year will be divided in the above format and i need to check in which quarter the system date falls.. can any one sugest me any idea
‎2007 Jan 22 3:43 PM
Hi Alex,
Please check this FM.
BKK_GET_QUARTER_DATE
HR_99S_GET_QUARTER
Otherwise you can try this sample code from other thread.
Assuming date format is MM/DD/YYYY.
v1 = date+0(2).
if V1 = '01' or v1 ='02' or v1 = '03'.
quarter = 1.
elseif V1 = '04' or v1 ='05' or v1 = '06'.
quarter = 2.
elseif V1 = '07' or v1 ='08' or v1 = '09'.
quarter = 3.
elseif V1 = 10' or v1 ='11' or v1 = '12'.
quarter = 4.
endif.
Regards,
Ferry Lianto
‎2007 Jan 22 3:41 PM
chk this
sorry this one
https://forums.sdn.sap.com/click.jspa?searchID=842442&messageID=2805380
Message was edited by:
Chandrasekhar Jagarlamudi
‎2007 Jan 22 3:49 PM
You can even check out these FM's
BKK_GET_QUARTER_DATE
TSTR_PERIODS_QUARTERS
HR_99S_GET_DATES_QUARTER
SLIM_GET_QUARTERLY_PERIODS
RS_VARI_V_QUARTER1XXXX
RS_VARI_V_QUARTER2XXXX
RS_VARI_V_QUARTER3XXXX
RS_VARI_V_QUARTER4XXXX
Regards,
Santosh
‎2007 Jan 22 3:57 PM
hi Alex,
I guess you cannot view that theread ... here is that answer..
report ztest_0001.
data: xspbup type spbup.
data: xgjahr type bkpf-gjahr.
data: xpoper type t009b-poper.
data: check_spbup type spbup.
ranges: q1 for xspbup.
ranges: q2 for xspbup.
ranges: q3 for xspbup.
ranges: q4 for xspbup.
q1-sign = 'I'.
q1-option = 'BT'.
q1-low+0(4) = sy-datum+0(4).
q1-low+4(2) = '01'.
q1-high+0(4) = sy-datum+0(4).
q1-high+4(2) = '03'.
append q1.
q2-sign = 'I'.
q2-option = 'BT'.
q2-low+0(4) = sy-datum+0(4).
q2-low+4(2) = '04'.
q2-high+0(4) = sy-datum+0(4).
q2-high+4(2) = '06'.
append q2.
q3-sign = 'I'.
q3-option = 'BT'.
q3-low+0(4) = sy-datum+0(4).
q3-low+4(2) = '07'.
q3-high+0(4) = sy-datum+0(4).
q3-high+4(2) = '09'.
append q3.
q4-sign = 'I'.
q4-option = 'BT'.
q4-low+0(4) = sy-datum+0(4).
q4-low+4(2) = '09'.
q4-high+0(4) = sy-datum+0(4).
q4-high+4(2) = '12'.
append q4.
call function 'FI_PERIOD_DETERMINE'
exporting
i_budat = sy-datum
i_periv = 'YT'
importing
e_gjahr = xgjahr
e_poper = xpoper.
check_spbup+0(4) = xgjahr.
check_spbup+4(2) = xpoper.
if check_spbup in q1.
write:/ 'This date is under Q1'.
endif.
if check_spbup in q2.
write:/ 'This date is under Q2'.
endif.
if check_spbup in q3.
write:/ 'This date is under Q3'.
endif.
if check_spbup in q4.
write:/ 'This date is under Q4'.
endif.
‎2007 Jan 22 3:42 PM
hi Alex,
Check out Rich's Answer in this thread
https://forums.sdn.sap.com/click.jspa?searchID=842366&messageID=2124693
Regards,
Santosh
‎2007 Jan 22 3:43 PM
alex,
just take offset of date and check like.
v_date = sy-datum+4(2).
check v_date falls in between '01' and '03', then give 'first quarter'.
or '04 and '06' second quarter......
regds,
kiran
‎2007 Jan 22 3:43 PM
Hi Alex,
Please check this FM.
BKK_GET_QUARTER_DATE
HR_99S_GET_QUARTER
Otherwise you can try this sample code from other thread.
Assuming date format is MM/DD/YYYY.
v1 = date+0(2).
if V1 = '01' or v1 ='02' or v1 = '03'.
quarter = 1.
elseif V1 = '04' or v1 ='05' or v1 = '06'.
quarter = 2.
elseif V1 = '07' or v1 ='08' or v1 = '09'.
quarter = 3.
elseif V1 = 10' or v1 ='11' or v1 = '12'.
quarter = 4.
endif.
Regards,
Ferry Lianto
‎2007 Jan 22 3:57 PM
try this example....
data : v_date type i.
start-of-selection.
v_date = sy-datum+4(2).
if v_date ge 1 and v_date le 3.
write : 'first quarter'.
elseif v_date ge 3 and v_date le 6.
write : 'sec quarter'.
elseif v_date ge 6 and v_date le 9.
write : 'third quarter'.
elseif v_date ge 9 and v_date le 12.
write : 'fourth quarter'.
endif.
regds,
kiran
‎2007 Jan 22 4:02 PM
Hi
Please check the following code
TYPE-POOLS: P99SG.
DATA: ws_permo TYPE p99sg_quarter.
CALL FUNCTION 'HR_99S_GET_QUARTER'
EXPORTING
im_date = sy-datum
IMPORTING
ex_quarter = ws_permo
ws_permo-q will contain the quarter number..