cancel
Showing results for 
Search instead for 
Did you mean: 

Default Value Current Month for Fiscal Year Period Variable

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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.

Former Member
0 Kudos

Hello Rahul ,

Thanks for reply.

My requirement is not just getting the current fiscal year period from Sy Datum, but it is different.

I have already think of writing BEx Customer Exit.

My requirement is that this BEX Customer Exit should appear in the Default Value Tab of Fiscal Year Period Variable.

I tried Copy from Personalization , but Customer Exit variables do not appear in the Copy from Personalization Tab.

Any other Suggestion is welcome.

Best Regards,

Amol

Former Member
0 Kudos

Hi Amol,

What you can do is that maintain this variable as customer exit type and select the option for 'Ready for Input' in variable.

In this way, the value for your variable will get calculated through exit and this value would come as a pop-up for selection. Here, you may see the value that is going to be used and also, if required you can change it before execution of query.

Former Member
0 Kudos

Hello Rahul and Surendra ,

I have written below code,

Note that variable ZPER_FISCPER is Single Value Optional Customer Exit with Ready for Input Check Mark.

Still I could not see the Default Value as current month.

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.

loop at i_t_var_range into

loc_var_range where vnam = 'ZP_FPER1'.

fdate = loc_var_range-low.

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.

ENDLOOP.

ENDIF.

ENDCASE.

Former Member
0 Kudos

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.

Answers (1)

Answers (1)

former_member181964
Active Contributor
0 Kudos

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