Skip to Content
author's profile photo Former Member
Former Member

Default Value Current Month for Fiscal Year Period Variable

Hello BI Experts,

I have a requirement that when the user execute a report he should by Default see the Current Month on

a Fiscal Year Period Variable .

For Example : Say we have ZP_FPER as Single Value Optional Variable on 0FISCPER Fiscal Year Period.

When we execute the Query we should see the Default Value of ZP_FPER as Current Month 004.2010

We have Fiscal Year Variant as V3 ( April to March ).

Any suggestions Please.

Regards,

Amol

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jul 08, 2010 at 10:58 AM

    Hi Amol,

    You can do this. For this, you need to create a variable which has processing by 'customer exit'.

    After doing this, you need to write the exit under function exit 'EXIT_SAPLRRS0_001' for this variable.

    case i_vnam.

    when 'ZSYDAT'.

    use function module DATE_TO_PERIOD_CONVERT to get current fiscal month.

    e_t_range_wa-sign = 'I'.

    e_t_range_wa-opt = 'EQ'.

    e_t_range_wa-low = zdatum(this is the value derived from function module).

    append e_t_range_wa to e_t_range.

    This should solve your problem.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Amol,

      Try this.

      data : fdate like sy-datum.

      DATA : ZFISCPER(7) TYPE N.

      DATA : PERIOD LIKE T009B-POPER.

      DATA : FYEAR LIKE T009B-BDATJ.

      case i_vnam.

      when 'ZPER_FISCPER'.

      IF i_step = 1.

      fdate = sy-datum or 0dat (this is required to give today's date)

      CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'

      EXPORTING

      I_DATE = fdate

      • I_MONMIT = 00

      I_PERIV = 'V3'

      IMPORTING

      E_BUPER = PERIOD

      E_GJAHR = FYEAR

      EXCEPTIONS

      INPUT_FALSE = 1

      T009_NOTFOUND = 2

      T009B_NOTFOUND = 3

      OTHERS = 4

      .

      IF SY-SUBRC 0.

      • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

      • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

      ENDIF.

      CONCATENATE fyear period INTO ZFISCPER.

      clear l_s_range.

      l_s_range-low = ZFISCPER.

      l_s_range-sign = 'I'.

      l_s_range-opt = 'EQ'.

      APPEND l_s_range to e_t_range.

      ENDIF.

      I don't think that you need loop. Also, the variable that you were assiging to fdate earlier would have been blank as no value was passed to it. Try the code given above.

  • Posted on Jul 08, 2010 at 11:40 AM

    Hi

    See code for Month to Period, so customize the same for your requirement.

    See for all Customer Exit codes in

    http://wiki.sdn.sap.com/wiki/display/profile/Surendra+Reddy

    Under

    Customer Exit Variables in BW/BI Reports

    Copy an dpast in SE38 and check the result.

    DATA:   ZRSCALMONTH TYPE RSCALMONTH,
            ZPERIV TYPE PERIV,
            ZPOPER TYPE POPER,
            ZBDATJ TYPE BDATJ,
            ZRSFISCPER TYPE  RSFISCPER.
     
    ZRSCALMONTH = '200903'.
    ZPERIV  = 'V3'.
     
    CALL FUNCTION 'FISCPER_FROM_CALMONTH_CALC'
      EXPORTING
        IV_CALMONTH       = ZRSCALMONTH
        IV_PERIV          = ZPERIV
     IMPORTING
       EV_FISCPER3       = ZPOPER
       EV_FISCYEAR       = ZBDATJ
       EV_FISCPER        = ZRSFISCPER.
     
     
    WRITE:/ ZPOPER.
    WRITE:/ ZBDATJ.
    WRITE:/ ZRSFISCPER.

    See the Customer Exit Code.And change it.

    WHEN 'ZC_FFYPRD'.
    
        IF i_step = 2.
          LOOP AT i_t_var_range INTO loc_var_range WHERE vnam = 'ZS_MONTH'.
            IF sy-subrc = 0.
    
              CLEAR: l_s_range.
    
              zcmnth = loc_var_range-low.
    
              CALL FUNCTION 'FISCPER_FROM_CALMONTH_CALC'
                EXPORTING
                  iv_calmonth       = zcmnth
                  iv_periv          = 'V3'
               IMPORTING
    *             EV_FISCPER3       =
    *             EV_FISCYEAR       =
                  ev_fiscper        = zfyprd.
    
              l_s_range-low+4(3)  = '001'.
              l_s_range-low+0(4)  = zfyprd+0(4).
              l_s_range-sign = 'I'.
              l_s_range-opt = 'EQ'.
              APPEND l_s_range TO e_t_range.
    
            ENDIF.
          ENDLOOP.
        ENDIF.

    Thanks

    Reddy

    Edited by: Surendra Reddy on Jul 8, 2010 1:41 PM

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.