Skip to Content

function to get quarter

Hi all

Hi , is there any function to get Current Quarter of the year??

Thank you all

Add comment
10|10000 characters needed characters exceeded

2 Answers

  • Posted on Aug 03, 2006 at 02:00 AM

    Don't think that there is a standard function. You will need to determine what the current period which sy-datum falls under using function module 'FI_PERIOD_DETERMINE'. Then in your code, you will need to determine the 4 buckets for the quarters in ranges. Then check the value against each range.

    REgards,

    Rich Heilman

    Add comment
    10|10000 characters needed characters exceeded

    • Take the following for example.....

      
      report zrich_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.
      
      

      Regards,

      Rich Heilman

  • Posted on Aug 03, 2006 at 03:48 AM

    Hi Kokwei,

    Please check this 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

    Hope this will help.

    Regards,

    Ferry Lianto

    Please reward points if helpful.

    Add comment
    10|10000 characters needed characters exceeded