For some kind of business scenario’s there
will be requirement to control the
Variable Value based on certain criteria . These Variable values could be
Default values to be filled on Selection screen for example giving range for Calendar Month Interval or
single entry value for Month.
Brother HL-2270DW Laser Printer (Google Affiliate Ad)
Brother HL-2270DW Laser Printer (Google Affiliate Ad)
The second
kind of requirement will be deriving the input value of second variable
based User Input on the selection screen .
The typical scenario could be getting the previous year month based on the input Month entered by user on
the selection screen.
The third one will be modifying the values of
all the Variables either entered by User or derived dynamically.
Most of the time we will be working first two
kind of scenarios. These are controlled
based on the time of execution step of the Query. The details are..
The customer exit for variables is called
three times maximally.
These three steps are called under I_STEP.
The first step (I_STEP = 1) is 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 variable
with default values.
The second step (I_STEP = 2) is called after
the processing 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”.
The third step (I_STEP = 3) is called after
all variable processing and gets called only once and not per variable. Here
you can validate the user entries
The Steps ….
First we need to create a project for Custom
changes for Reporting. Usually it is already done as default.
Tcode CMOD
from menu bar
After giving necessary info click create and click Enhancement on the following
screen.
If you choose Enhancement assignment option
you will see like below. These are objects called while executing the Query.
Under component options you will see the
Function Modules associated with these.
Double click on the Fm and you will be taken
to respective program where we are going add code for your Custom Variables. In
general you can access this Program directly using Tcode SE38 and entering the
program name ZXRSRU01. Double click on ZXRSRU01 below
Epson Expression Home XP-400 Small-in-One Printer C11CC07201 (Google Affiliate Ad)
Epson Expression Home XP-400 Small-in-One Printer C11CC07201 (Google Affiliate Ad)
And you enter the code like below.
DATA: l_s_range TYPE
rsr_s_rangesid,
loc_var_range LIKE rrrangeexit.
DATA: wf_fday TYPE sy-datum.
DATA: wf_lday TYPE sy-datum.
DATA: wf_year TYPE
/bi0/oifiscyear.
DATA: wf_flag TYPE c VALUE 'X'.
IF
i_step = 1.
CASE i_vnam.
WHEN 'ZT_CALMTH'.
* Fill the value for User and he
can change the same. Here it gets current month and year
l_s_range-low = sy-datum+0(4).
l_s_range-low+4(2) = sy-datum+4(2).
l_s_range-sign = 'I'.
l_s_range-opt = 'EQ'.
APPEND l_s_range TO e_t_range.
ENDCASE.
ELSEIF
i_step = 2.
CASE i_vnam.
WHEN 'ZT_CALMONTH_1' .
* based on the value entered by
User the value for this variable is derived. Value filled as
* get the priviouse year of the user entered and month.
READ TABLE i_t_var_range INTO loc_var_range WITH
KEY vnam = 'ZT_CALMTH'.
IF sy-subrc = 0.
l_s_range-low+0(4) = loc_var_range-low+0(4) - 1.
l_s_range-low+4(2) = loc_var_range-low+4(2).
l_s_range-sign = 'I'.
l_s_range-opt = 'EQ'.
APPEND l_s_range TO e_t_range.
ENDIF.
ENDCASE.
ENDIF.
But before even coming here you need to create
the variables for which you want to control using Customer Exit. That will be
done as follows.
First Variable ZT_CALMTH for which user will
have some value on selection Screen…
Create Second Variable for which the value is filled based
on the above Variable value.
Variable ZT_CALMONTH_1.
Under detail tab uncheck the box for Variable ready for
Input as this is filled by program.
Create new Query with
Net value restricted for each Variable which created above.
The details for Key figures below see same Key figure is restricted by variables created above.
The Result of the same as follows..
Once you execute the query the values are pre populated from
program.
The default value is current month . But user can change
this if he needs some other month.
The result will be.
Here user changed above to 01/2012 and he got the value for previous
year same month . This is achieved from second Variable.
Your content is nothing short of bright in many forms. I think this is friendly and eye-opening material. I have gotten so many ideas from your blog. Thank you so much. exit-5
ReplyDelete