I_STEP variable
All about I_STEP
When we execute the BEx query, the sequence of execution starts with the variable selection screen being popped up if any variable is present in the query, and then the output will be displayed based on the values which passed in the variable selection as per below sequence.
I_STEP is a variable, generally used in ABAP Customer exit, which can take the values 0,1, 2 or 3.
I_STEP = 1 :
In some of the reports, we may have a need to display default values in the variable selection screen even before its execution. For example, to display the execution date, time. In such cases we need to write /execute some of the ABAP customer exit code before the variable selection screen starts.
In Customer Exits, if the variable I_STEP = 1, it means ABAP customer exit code will be executed before the variable selection screen pops up.
I_STEP = 1 is before the processing of the variable and hence this we can be used for default selection-screen values.
I_STEP = 2 :
In some of the reports, we may have a need to calculate MTD(Month to Date), YTD (Year to Date) . In such cases the report output is based on the input value in the selection screen and ABAP Customer exit calculation. In such cases the ABAP customer exit code has to be executed after the input screen.
The above screen indicates the sequence followed when we execute the MTD, YTD et al. reports.
1. The input values are passed to the variable selection screen.
2. ABAP Customer exit is executed based on the input selection screen.
3. The output is displayed based on the ABAP Customer exit code.
I_STEP = 2 is useful to find the YTD, MTD, rolling quarter, etc…
In a report we can have I_STEP = 1 and I_STEP = 2 depending on the requirement as shown below.