This part I will explain the third point: BEx Variables.
We can use ABAP coding to fill a variable value.
Here we should use the standard SAP Enhancement 'RSR00001'.
- Through TCODE: SMOD, fill in the enhancement, you can see the details.
- In the function module of this enhancement, you will find include ZXRSRU01 where you implement your program code.
- The exit is called four times, called '"steps" (I_STEP)
Step 1(I_STEP = 1): is called before the processing of the variable pop-up and gets called for every variable of the processing type,"customer exit." You can use this step to fill your varibale with a default or proposal value.
Step 2(I_STEP = 2): is called after porcessing of the variable pop-up. This step is called only for those variables that are not marked as "ready for input" and are set to "mandatory variable entry"
Step 3(I_STEP = 3): is called after all variable processing and gets called only once and not per variable. Here you can validata the user entries.
Step 0(I_STEP = 0): is called for variables that are used in authorizations objects.
Note: You can nto overwrite the user input values into a variaable with this customer exit. You can only derive values for other variables or validate the user entries.
Code in ZXRSRU01 is for your reference:
Comment: TIM_VAR is the variable that is created in BEx Query Designer and its type is customer exit so that it can be called through the function module.
In this demo, I put the I_STEP = 1, that means before the variable pop-up, I give the value 'current date' for this variable.