Skip to Content
avatar image
Former Member

To display data according to 0CALMONTH

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.



Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

3 Answers

  • Best Answer
    Sep 19, 2014 at 09:33 AM


    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.

    Standard Variables in BEX related to Time Charcteristics



    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 19, 2014 at 06:15 PM

    Dear Girish,

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

    READ statement.

    *** 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.



    Add comment
    10|10000 characters needed characters exceeded

  • Sep 19, 2014 at 09:04 AM

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

    Add comment
    10|10000 characters needed characters exceeded