Skip to Content

Dynamic period restriction for few columns

hi experts

Please help with code for dynamic text variable for year, and dynamic restriction for key figure with period variable.

I am having a query and it has year and period as selection variables and i have 6 columns and row( customer).

If user enters year = 2018 and period as 5 then my report heading should be like this.(I am separating headings with , to differentiate the columns here)

Customer, Actual Curr yr 2018, Acutal prior yr 2017, Plan Curr yr 2018, Plan prior yr 2017

1. For column 2 i.e Acutal curr yr 2018 - Here the year is what the user has entered

For column 3 i.e Actual prior yr 2017 - Here we have to minus year by 1 and display as 2017

2. For first column if user enters period as P5, then I need to restict the key figure with P1+P2+P3+P4+P5

For third column the period will be P6+P7+P8+P9+P10+P11+P12+P13.

please help how to write the exit for this 2 requriements.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Nov 28, 2017 at 07:51 AM

    set up query:

    general filters: year -> set restriction as interval and add in high(to) and low(from) the same user exit variable and do an offset on the low (from) of minus 1. "this because you need data of this year and previous year

    create a formula with a formula variable so the user can enter "5" as a period, you don't set in the general filter because you need all the periods P1 ->P5 and P5->P13

    For column actual this year create restricted key figure on year and create a userexit variable, not input ready and mandatory, in the user exit program write code to collect the filled out year in I_step=2.

    For column previous year create restricted key figure on year and create a userexit variable, not input ready and mandatory, in the user exit program write code to collect the filled out year minus 1 in I_step=2.

    For column P1_P5 create restricted key figure on year and create a userexit variable, not input ready and mandatory, in the user exit program write code to collect the filled out year & month in I_step=2 and wirte it as an interval in a contatenate of year and month,

    For column P1_P5 create restricted key figure on year and create a userexit variable, not input ready and mandatory, in the user exit program write code to collect the filled out year & month in I_step=2 and write it as an interval in a contatenate of year and month

    I_STEP explanation:

    https://blogs.sap.com/2013/12/13/all-about-istep-variable/

    Code example: < there are a lot of these>

    https://archive.sap.com/discussions/thread/3566201

    Add comment
    10|10000 characters needed characters exceeded