cancel
Showing results for 
Search instead for 
Did you mean: 

To display data according to 0CALMONTH

Former Member
0 Kudos

Hi experts,

I have a request where User wants in selection screen default value to be 0calmonth -1(ex for september 14(09.2014) default value should be aug 14(08.2014).

And they want the data to be displayed in reports is from previous 5 years i.e from Jan 2010 to 0calmonth -1 (from 01.2010 - 08.2014)

I am not sure how we can achieve this in Bex.

Please provide some inputs.

Regards,

Girish

Accepted Solutions (1)

Accepted Solutions (1)

KodandaPani_KV
Active Contributor
0 Kudos

Hi,

about first question use the  0CMLMON satndard variable you will get the last month data.

and second question you need to go cusotm exit with simple code.

please find the below document.

Thanks,

Phani.

Answers (2)

Answers (2)

Former Member
0 Kudos

Dear Girish,

I) create the variable. On Tcode-CMOD use the below logic by assigning your variable on the

READ statement.

*declarations
*** Declarations ***
    " Local structures
    DATA  : ls_range_per      LIKE LINE OF e_t_range,
            ls_var_range_per  LIKE LINE OF i_t_var_range.

    " Local variables
    DATA  : lv_period         TYPE d.

* Logic

    IF i_step = 2.

      READ TABLE i_t_var_range
        INTO ls_var_range_per
        WITH KEY vnam = '<Your variable>'.
      IF sy-subrc EQ 0.
        lv_period       = ls_var_range_per-low.

" to get the year 5 years back
lv_period+0(4)  = lv_period+0(4) - 5.

" To make the month as JAN
lv_period+4(2) = '01'.

" To the the previous month
ls_var_range_per-low+4(2) = ls_var_range_per-low+4(2) - 1.

        ls_range_per-sign   = 'I'.
        ls_range_per-opt    = 'BT'.
        ls_range_per-low    = lv_period . " 200901
        ls_range_per-high   = ls_var_range_per-low. " 201408

        APPEND ls_range_per TO e_t_range.
        CLEAR ls_range_per.
      ENDIF.
    ENDIF.

Regards,

Ragunathan.R

Former Member
0 Kudos

Dear Ragu,

Thanks for your detail code.

I have one doubt it will give data from five years back till current month -1. That is ok. 

But I want in selection screen the Value should be by default current month-1, and when user runs the report they should get data from five years back to cur month -1.

Can we achieve this using Istep=1? Please let us know your inputs.

Regards,

Girish

Former Member
0 Kudos

Dear Girish,

Yes, you are correct using ISTEP = 1 we have to default current month -1.

then using ISTEP = 2 we could perform the five years back to current month -1.

So in my logic slight change is required.

Thanks & Regards,

Ragunathan.R


Former Member
0 Kudos

Dear Ragu,

Thanks for your explanation. I will use this on dummy variable to check if it is working or not.

Regards,

Girish

RafkeMagic
Active Contributor
0 Kudos

that's quite basic... read up on user exit for BW variables