Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Function Module

Former Member
0 Likes
406

Hi ,

I need a functional module which converts date to particular quarter..

Input date : 11/22/2206

Output : 200601 (YYYYQQ)

Ie., here oct,nov & Dec are Q1

Jan,feb,mar Q2 ect…

Regards

1 REPLY 1
Read only

Former Member
0 Likes
328

hi,

Check this out

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

Check any of these FM

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